| View previous topic :: View next topic |
| Author |
Message |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Mon Aug 26, 2002 5:55 pm Post subject: Which element has the focus? |
|
|
I thought I remembered a post about how to determine which dialog element has the focus at a given time. I've looked but haven't turned up anything.
Am I just feeling the effects of this Monday or is there a way to tell? |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Mon Aug 26, 2002 6:09 pm Post subject: |
|
|
Maybe you can try to make something with the EXIT style...
Or make something that sends a character to your dialog, and check which edit-box is changing. After that, send a @key(DEL) to remove that input... |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Aug 26, 2002 6:20 pm Post subject: |
|
|
If you're using VDS 4.x, then use the @focus() function to return the element name which currently has the focus.
-Garrett |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Mon Aug 26, 2002 7:00 pm Post subject: |
|
|
Good to know... I'm using 3.51 but have been thinking about buying 4.5...
Until then, maybe I'll try to work with skit3000's suggestions. Thanks! |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Aug 26, 2002 9:18 pm Post subject: |
|
|
Hi Hortalonus,
You could also use the Win32 API to get the windows handle of the active element. Here is the code for use with the gadget.dll.
| Code: |
External Gadget.dll,<Reg Code>
%%user32 = @Gadget(LoadLib,user32.dll)
Gadget Declare,GetFocus,%%user32,GetFocus,Void As Pointer,Handle
Title Test
DIALOG CREATE,New Dialog,-1,0,240,160
DIALOG ADD,BUTTON,BUTTON1,108,32,64,24,BUTTON1
DIALOG ADD,BUTTON,BUTTON2,108,144,64,24,BUTTON2
DIALOG ADD,EDIT,EDIT1,40,28,180,20,EDIT1
DIALOG SHOW
Rem Now just call the function like the next line when you want to know
rem which element has the focus.
%%ActiveElement = @Gadget(GetFocus,NULL)
Info This is the VDS element that has the focus %%ActiveElement.
:Evloop
wait event
goto @event()
:BUTTON1BUTTON
info Replace this line with code to process the BUTTON1BUTTON event
goto evloop
:BUTTON2BUTTON
info Replace this line with code to process the BUTTON2BUTTON event
goto evloop
:Close
info Replace this line with code to be executed before the dialog closes
exit
|
Have fun... _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Tue Aug 27, 2002 3:47 pm Post subject: |
|
|
Hey, thanks for all the ideas! It is much appreciated. |
|
| 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
|
|