| View previous topic :: View next topic |
| Author |
Message |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Wed Aug 11, 2004 2:30 pm Post subject: Hotkeys for App only |
|
|
Hi,
is there a way to define an hotkey for my application only ?
If I use the vds5 hotkey command, this hotkey is defined for the whole system.
I want to give the user the option to hit the del key to delete an list entry.
I thought about an check in the :hotkey event
| Code: | if @winactive(mywin)
my hotkey commands
else
re-send the hotkey to the active windows
end |
but I think this is not the way it should be.
Bye, Fabian |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Aug 11, 2004 3:30 pm Post subject: |
|
|
How about this? It uses a menu item as a (local) hotkey...
| Code: | DIALOG CREATE,Nieuw Dialoog,-1,0,240,160
DIALOG ADD,LIST,LIST1,9,1,239,144
DIALOG ADD,MENU,-,Delete|DEL
DIALOG SHOW
list add,list1,Just some text
list add,list1,fghgnytuthjngn
list add,list1,fghrty4rthfghf
list add,list1,rhrtyrtyrthfgg
list add,list1,nnykolrghhfjjh
list add,list1,tyrtyjmymhjmhj
list add,list1,jrhythgnghjngh
list add,list1,rtyrtyhnghntyg
list add,list1,rtrtebfbretyfg
list add,list1,sdfsdfsdfsdfsd
list add,list1,And this is th
list add,list1,e last line...
:Evloop
wait event
goto @event()
:DeleteMENU
if @greater(@index(list1),-1)
list delete,list1
end
goto Evloop
:Close
exit |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Wed Aug 11, 2004 3:46 pm Post subject: |
|
|
Nice idea But this method grabs some space on the top of the dialog (maybe half of the space a real menu would need). Maybe I can hide the menu.
Do you know another way? |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Aug 11, 2004 4:29 pm Post subject: |
|
|
You can try this
| Code: | # HotKey active for app only (not global) demo
# VDS 5 Compatible Only
# Script by FreezingFire
#
# The script uses a TIMER event
OPTION DECIMALSEP,"."
TITLE HotKey Test by FreezingFire
DIALOG CREATE,HotKey Test,-1,0,240,115
DIALOG ADD,STYLE,BOLD,,,B,,
DIALOG ADD,TEXT,TEXT1,16,11,,,This demonstrates a hotkey active for@cr()this window only.,,BOLD
DIALOG ADD,BUTTON,Close,77,87,64,24,Close
DIALOG SHOW
# Add hotkey
HOTKEY ADD,TEST,Ctrl+D
:Evloop
# The timer can be changed to something less frequent to save CPU usage
wait event,0
goto @event()
:Timer
if @unequal(@winactive(I),@winexists(@dlgtext()))
HOTKEY REMOVE,TEST
else
HOTKEY ADD,TEST,Ctrl+D
end
goto evloop
:Hotkey
if @equal(@hotkey(),TEST)
info You pressed the HotKey!
end
goto evloop
:Close
:CloseBUTTON
exit |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Aug 11, 2004 5:07 pm Post subject: |
|
|
You might want to place a toggle variable in that timer loop so that it
doesn't keep adding the hotkey when active and removing the hotkey
when inactive.
| Code: | if @unequal(@winactive(I),@winexists(@dlgtext()))
IF @not(%%HotToggle)
HOTKEY REMOVE,TEST
%%HotToggle = 1
END
else
IF %%HotToggle
HOTKEY ADD,TEST,Ctrl+D
%%HotToggle =
END
end |
_________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Wed Aug 11, 2004 5:20 pm Post subject: |
|
|
thanks for your ideas  |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Aug 11, 2004 10:57 pm Post subject: |
|
|
Garrett I actually had that in the code but for some reason it wasn't working well so I took it out. Thanks for adding it.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Aug 12, 2004 2:41 am Post subject: |
|
|
Make sure you seed the variable to what ever the opening setting should
be when you first start the script. _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Thu Aug 12, 2004 11:23 am Post subject: |
|
|
A method I've used is to create a small button with a caption e.g. "&D" which you can position off the window and hide it. It still responds with the usual button events.
You could probably also do something with OPTION MSGEVENT for WM_CHAR messages, or something along those lines. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Thu Aug 12, 2004 1:51 pm Post subject: |
|
|
i was going to suggest a variance on jules' idea...create a 0x0 button with the name &DELETE...this way ALT+D will be your hot key
serge _________________
|
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Aug 12, 2004 2:44 pm Post subject: |
|
|
This one does use local hotkeys... Thanks at Julian for the idea...
| Code: | option msgevent,$100,Keydown
DIALOG CREATE,Nieuw Dialoog,-1,0,240,160
DIALOG ADD,LIST,LIST1,9,1,239,144
DIALOG SHOW
list add,list1,Just some text
list add,list1,fghgnytuthjngn
list add,list1,fghrty4rthfghf
list add,list1,rhrtyrtyrthfgg
list add,list1,nnykolrghhfjjh
list add,list1,tyrtyjmymhjmhj
list add,list1,jrhythgnghjngh
list add,list1,rtyrtyhnghntyg
list add,list1,rtrtebfbretyfg
list add,list1,sdfsdfsdfsdfsd
list add,list1,And this is th
list add,list1,e last line...
:Evloop
wait event
goto @event()
:Keydown
# Checks if the pressed key is the delete key
if @equal(@msgparams(W),46)
# Sees if the focus is on list1, otherwise, skip it
if @equal(@focus(),LIST1)
# Only delete a list item if the index isn't -1
if @greater(@index(LIST1),-1)
list delete,LIST1
end
end
end
goto Evloop
:Close
exit |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Last edited by Skit3000 on Thu Aug 12, 2004 2:47 pm; edited 1 time in total |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Thu Aug 12, 2004 2:45 pm Post subject: |
|
|
cool
serge _________________
|
|
| 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
|
|