cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Tue Apr 12, 2011 9:34 pm Post subject: Tab and Delete in Browser |
|
|
Relies on VDSDOM50.DSU
http://www.vdsworld.com/forum/viewtopic.php?p=36186
Demonstrates 2 new functions and 3 new commands.
UPDATED 4/13/2011 Please replace your old repository if you saved this example. The new version releases the hotkeys back to the operating system entirely when the window is not active rather than handling the operation globally for all windows, which was't very smart.
Code: | external vdsbrw50.dll
#include vdsdom50.dsu
#define command,browser
#define function,browser
title Browser Tab Example
DIALOG CREATE,Browser TAB Example,-1,0,341,225,class cnodnarb
REM *** Modified by Dialog Designer on 4/10/2011 - 22:48 ***
DIALOG ADD,browser,Browser1,0,0,336,220,""
DIALOG SHOW
loadlib "psapi.dll"
%t = @lib("psapi.dll","EmptyWorkingSet",INT:,-1)
freelib "psapi.dll"
%%hot = 0
directory change,@path(%0)
dialog set,browser1,<html><body><input><br><input><br><input><br><input><br><input></body></html>
browser savefile,browser1,@curdir(%0)test.html
dialog set,browser1,@curdir(%0)test.html
rem setattribute browser1,tag,body,contentEditable,True,0
repeat
until @not(@browser(browser1,busy))
createfocused browser1
:timer
if @equal(@winactive(),@dlgtext())
if @equal(%%hot,0)
hotkey add,hottab,TAB
hotkey add,delnow,DEL
%%hot = 1
end
else
if @equal(%%hot,1)
%%hot = 0
hotkey remove,hottab
hotkey remove,delnow
end
end
:evloop
wait event,.1
goto @event()
:close
exit
:hotkey
%%hotkey = @hotkey()
if @equal(%%hotkey,hottab)
goto hottab
end
if @equal(%%hotkey,delnow)
goto delnow
end
:hottab
%%x = @getelementcount(browser1,tag,input)
%%y = 0
repeat
if @equal(@getattribute(browser1,tag,input,focused,%%y),true)
%%z = %%y
end
%%y = @succ(%%y)
until @equal(%%y,%%x)
if @equal(@succ(%%z),%%x)
%%z = -1
end
setfocus browser1,tag,input,@succ(%%z)
goto evloop
:delnow
execcommand browser1,"'Delete'"
goto evloop
|
|
|