Вверх ↑
Разработчик
Ответов: 26170
Рейтинг: 2127
#1: 2013-03-27 19:35:39 ЛС | профиль | цитата
Sova-Kmv писал(а):
А вот-так можно и не добавлять элемент

Я бы лучше такой модуль прицепил

Add(InlineCode,10977955,392,238)
{
WorkPoints=#16:doSetValueByName|20:doSetFocusByName |17:doSetFocusByValue|13:doClickByName|15:doClickByValue |
EventPoints=#10:onSetValue|10:onSetFocus|
DataPoints=#2:ph|4:name|5:value|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|40:uses kol,Share,Debug,ActiveX,KOLSHDocVw;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|0:|9: public|18: ph: THI_Event;|20: name: THI_Event;|21: value: THI_Event;|26: onSetValue: THI_Event;|26: onSetFocus: THI_Event;|27: onClick: THI_Event; |0:|57: procedure doSetValueByName(var dt:TData; index:word);|61: procedure doSetFocusByName(var dt:TData; index:word); |58: procedure doSetFocusByValue(var dt:TData; index:word);|58: procedure doClickByName(var dt:TData; index:word); |64: procedure doClickByValue(var dt:TData; index:word); |0:|5: end;|0:|14:implementation|0:|4:type|31: TKOLWebBrowser = PWebBrowser;|31: PKOLWebBrowser = PWebBrowser;|0:|74:function FindIdx(pc: PControl; val: string; FindByName: boolean): Integer;|3:var|13: i: integer;|5:begin|15: Result := -1;|85: for i := 0 to PKOLWebBrowser(pc).OleObject.Document.all.tags('input').length - 1 do|22: if FindByName then|13: begin |88: if PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(i).name = val then|11: begin|20: Result := i;|15: break; |10: end;|7: end|12: else |9: begin|89: if PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(i).value = val then|11: begin|20: Result := i;|15: break; |10: end;|8: end;|6:end; |0:|39:procedure THiAsmClass.doSetValueByName;|3:var|15: pc: PControl;|19: txt, val: string;|15: idx: integer;|5:begin|37: pc := PControl(ToIntegerEvent(ph));|32: if not Assigned(pc) then exit;|30: txt := ReadString(dt, name);|33: val := ReadString(dt, value); |32: idx := FindIdx(pc, txt, true);|24: if idx < 0 then exit; |81: PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(idx).value := val;|26: _hi_onEvent(onSetValue);|4:end;|0:|39:procedure THiAsmClass.doSetFocusByName;|3:var|15: pc: PControl;|14: txt: string;|15: idx: integer;|5:begin|37: pc := PControl(ToIntegerEvent(ph));|32: if not Assigned(pc) then exit;|30: txt := ReadString(dt, name);|32: idx := FindIdx(pc, txt, true);|24: if idx < 0 then exit; |74: PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(idx).focus;|26: _hi_onEvent(onSetFocus);|4:end;|0:|40:procedure THiAsmClass.doSetFocusByValue;|3:var|15: pc: PControl;|14: val: string;|15: idx: integer;|5:begin|37: pc := PControl(ToIntegerEvent(ph));|32: if not Assigned(pc) then exit;|33: val := ReadString(dt, value); |33: idx := FindIdx(pc, val, false);|24: if idx < 0 then exit; |74: PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(idx).focus;|26: _hi_onEvent(onSetFocus);|4:end;|0:|36:procedure THiAsmClass.doClickByName;|3:var|15: pc: PControl;|14: txt: string;|15: idx: integer;|5:begin|37: pc := PControl(ToIntegerEvent(ph));|32: if not Assigned(pc) then exit;|30: txt := ReadString(dt, name);|32: idx := FindIdx(pc, txt, true);|24: if idx < 0 then exit; |74: PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(idx).click;|23: _hi_onEvent(onClick);|4:end;|0:|37:procedure THiAsmClass.doClickByValue;|3:var|15: pc: PControl;|14: val: string;|15: idx: integer;|5:begin|37: pc := PControl(ToIntegerEvent(ph));|32: if not Assigned(pc) then exit;|33: val := ReadString(dt, value); |33: idx := FindIdx(pc, val, false);|24: if idx < 0 then exit; |74: PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(idx).click;|23: _hi_onEvent(onClick);|4:end;|0:|4:end.|
}

карма: 22

0