| View previous topic :: View next topic |
| Author |
Message |
Woody Valued Newbie

Joined: 10 Jul 2003 Posts: 29
|
Posted: Wed Jul 23, 2003 6:23 pm Post subject: Defining a function/getting window id's of several windows |
|
|
I am attempting to create a function that gather data from a window that has several parent windows and many syblings.
Here is the function:
| Code: |
#DEFINE FUNCTION,WINLOC
%A = @WINDOW(%1,CHILD)
%B = @window(%A,Child)
%C = @window(%B,Child)
REPEAT
%D = @window(%C,Next)
%E = @winclass(%C)
if @not(@equal(%E,%1))
%C = %D
end
UNTIL @equal(%E,%1)
%F = @window(%C,Child)
REPEAT
%G = @window(%F,Next)
%H = @winclass(%F)
if @NOT(@equal(%H,%2))
%F = %G
end
UNTIL @equal(%H,%2)
EXIT
|
Here is the code:
| Code: |
#INCLUDE winloc.dsc
%%ver = @winloc(window1,child1,child2)
%I = @window(%%ver,Child)
REPEAT
%J = @window(%%ver,Next)
%K = @winclass(%I)
if @not(@equal(%K,%3))
%I = %J
end
UNTIL @equal(%K,%3)
%%newvar = @WINTEXT(%I)
info %%newvar
|
Have I gone in the wrong direction somewhere???  _________________ - Woody |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Jul 23, 2003 6:29 pm Post subject: |
|
|
You should add this to the function:
:winloc
This way VDS knows which sub to call...
To complete your code:
The function:
| Code: | :Winloc
%A = @WINDOW(%1,CHILD)
%B = @window(%A,Child)
%C = @window(%B,Child)
REPEAT
%D = @window(%C,Next)
%E = @winclass(%C)
if @not(@equal(%E,%1))
%C = %D
end
UNTIL @equal(%E,%1)
%F = @window(%C,Child)
REPEAT
%G = @window(%F,Next)
%H = @winclass(%F)
if @NOT(@equal(%H,%2))
%F = %G
end
UNTIL @equal(%H,%2)
EXIT |
The code:
| Code: | #INCLUDE winloc.dsc
#DEFINE FUNCTION,WINLOC
%%ver = @winloc(window1,child1,child2)
%I = @window(%%ver,Child)
REPEAT
%J = @window(%%ver,Next)
%K = @winclass(%I)
if @not(@equal(%K,%3))
%I = %J
end
UNTIL @equal(%K,%3)
%%newvar = @WINTEXT(%I)
info %%newvar |
I also placed the #define command in the code itself, so it works when you compile the function into a .DSU file. _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Jul 23, 2003 7:04 pm Post subject: |
|
|
Welcome to the forums, Woody!
You should always remember that placing an #INCLUDE directive makes
it just as if the code was there. You have to visualize that it's actually
part of the script when compiled and it needs a label just a GOSUB would.
You can also make functions by just placing the label in your code, it
doesn't need to be a separate file. Just a few things to think about. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Woody Valued Newbie

Joined: 10 Jul 2003 Posts: 29
|
Posted: Wed Jul 23, 2003 7:24 pm Post subject: Thanks! |
|
|
Thanks for your assistance!
I now have the function operating however say for example I wanted to pull out that last child window:
| Code: |
%Z = @winloc(Mainwindow,ChildWindow)
|
What do I need to do in the function to have it recognize that the final variable is what I am in search of?  _________________ - Woody |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Jul 23, 2003 8:00 pm Post subject: |
|
|
Do you mean "How do you output the result?"
Just use EXIT %%your_var_or_data _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|