forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Defining a function/getting window id's of several windows

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Woody
Valued Newbie


Joined: 10 Jul 2003
Posts: 29

PostPosted: Wed Jul 23, 2003 6:23 pm    Post subject: Defining a function/getting window id's of several windows Reply with quote

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??? Crying or Very sad

_________________
- Woody
Back to top
View user's profile Send private message AIM Address
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Wed Jul 23, 2003 6:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Jul 23, 2003 7:04 pm    Post subject: Reply with quote

Welcome to the forums, Woody! Hi

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
View user's profile Send private message Visit poster's website
Woody
Valued Newbie


Joined: 10 Jul 2003
Posts: 29

PostPosted: Wed Jul 23, 2003 7:24 pm    Post subject: Thanks! Reply with quote

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? Cool

_________________
- Woody
Back to top
View user's profile Send private message AIM Address
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Jul 23, 2003 8:00 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group