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 


Hotkeys for App only

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


Joined: 20 Sep 2001
Posts: 296
Location: Germany

PostPosted: Wed Aug 11, 2004 2:30 pm    Post subject: Hotkeys for App only Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Skit3000
Admin Team


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

PostPosted: Wed Aug 11, 2004 3:30 pm    Post subject: Reply with quote

How about this? It uses a menu item as a (local) hotkey... Smile

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
View user's profile Send private message
X-Tools
Valued Contributor
Valued Contributor


Joined: 20 Sep 2001
Posts: 296
Location: Germany

PostPosted: Wed Aug 11, 2004 3:46 pm    Post subject: Reply with quote

Nice idea Wink 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
View user's profile Send private message Send e-mail Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Aug 11, 2004 4:29 pm    Post subject: Reply with quote

You can try this Smile

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
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Aug 11, 2004 5:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
X-Tools
Valued Contributor
Valued Contributor


Joined: 20 Sep 2001
Posts: 296
Location: Germany

PostPosted: Wed Aug 11, 2004 5:20 pm    Post subject: Reply with quote

thanks for your ideas Laughing
Back to top
View user's profile Send private message Send e-mail Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Aug 11, 2004 10:57 pm    Post subject: Reply with quote

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. Wink
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Thu Aug 12, 2004 2:41 am    Post subject: Reply with quote

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
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Thu Aug 12, 2004 11:23 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Thu Aug 12, 2004 1:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Skit3000
Admin Team


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

PostPosted: Thu Aug 12, 2004 2:34 pm    Post subject: Reply with quote

Serge, you can also use a button with a value of "&D" to do the same... Smile The & sign only counts for the first character which is behind it... Smile
_________________
[ 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
Skit3000
Admin Team


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

PostPosted: Thu Aug 12, 2004 2:44 pm    Post subject: Reply with quote

This one does use local hotkeys... Wink Thanks at Julian for the idea... Smile

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
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Thu Aug 12, 2004 2:45 pm    Post subject: Reply with quote

cool Smile

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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