Page 1 of 2
#PB_Any support for AddKeyboardShortcut()!
Posted: Tue Jun 14, 2005 1:09 pm
by Dummy
I need #PB_Any support for AddKeyboardShortcut()!
If
Code: Select all
MenuID.l = AddKeyboardShortcut(WindowID(), #PB_Shortcut_Return, #PB_Any)
would work, I would be happy!
Posted: Fri Sep 16, 2005 4:17 pm
by Dummy
Fread doesn't like me!
He never answers to my requests

Posted: Fri Sep 16, 2005 4:32 pm
by thefool
he is on vacation.
Posted: Fri Sep 16, 2005 4:44 pm
by Dummy
since Tue Jun 14, 2005 14:09?
Posted: Sat Sep 17, 2005 8:55 am
by thefool
Btw to me it seems like a silly request! How would you handle to see the shortcut was called?
The last parameter is the event id it will return when called. If this is PB_ANY what is the use of this function???
Posted: Sat Sep 17, 2005 9:27 am
by Polo
PB_Any need to be supported where it is not, here and in the menu items for example.
Posted: Sat Sep 17, 2005 9:41 am
by thefool
but why here???
Posted: Sat Sep 17, 2005 10:22 am
by Dummy
U wanna post me my 2000 Lines Project where I need it or what?
I want to create multiple piriveatechat windows. All with a KEYBOARD SHORTCUT for Enter(to send the message)...how to obtain a free MenuID?!?
Posted: Sat Sep 17, 2005 10:38 am
by Polo
But keeping the ids for backyard compatibility is stupid, because using Ids instead of handle is not the way to code. (and I say that because writing #pb_any for every command i type is boring

)
Re: #PB_Any support for AddKeyboardShortcut()!
Posted: Sat Sep 17, 2005 10:40 am
by PB
Dummy, you don't understand how AddKeyboardShortcut works. The last
parameter is NOT dynamic -- it's a constant event code that YOU specify,
and it does NOT get allocated by the compiler. So, it CAN'T be used with
#PB_Any at all.
So, in your main event loop, you must check if the code YOU specified has
been triggered, and if it has, then you know this keyboard shortcut has been
pressed by the user. Do you understand now?
Also, the format of the command is...
Code: Select all
AddKeyboardShortcut(#Window, Shortcut, EventID)
...and not...
Code: Select all
MenuID.l = AddKeyboardShortcut(WindowID(), #PB_Shortcut_Return, #PB_Any)
...in other words, there is NO return code for calling it. Please read the manual.
Posted: Sat Sep 17, 2005 10:45 am
by Dummy
in other words, there is NO return code for calling it. Please read the manual.
I DID THAT! Or why do you think I post this in the FEATURE
REQUEST forum?
Then please tell me another method how to obtain a FREE(=UNUSED) MenuID(NOT EventID) for the Shourtcut
Posted: Sat Sep 17, 2005 10:59 am
by Polo
lol, PB
He's asking exactly the thing that can't be done, guess why

?
You tell him to read the manual, but you should read his post before

Posted: Sat Sep 17, 2005 11:00 am
by PB
Are you saying you'd like to be able to do something like this:
Code: Select all
EnterHit=AddKeyboardShortcut(WindowID(),#PB_Shortcut_Enter,#PB_Any)
ev=WaitWindowEvent()
If ev=#PB_Event_Menu
If EventMenuID()=EnterHit
; We know the user hit Enter!
EndIf
EndIf
If so, then this is a request that Fred would have to consider.
Sorry that I misunderstood you at first!

Posted: Sat Sep 17, 2005 11:09 am
by Pupil
Dummy wrote:in other words, there is NO return code for calling it. Please read the manual.
I DID THAT! Or why do you think I post this in the FEATURE
REQUEST forum?
Then please tell me another method how to obtain a FREE(=UNUSED) MenuID(NOT EventID) for the Shourtcut
Maybe this might work without the need of an unused id for the return key; just check which window/gadget has the focus when the return key is pressed and you'll know in which priv chat you need to take action..
Posted: Sat Sep 17, 2005 11:11 am
by Dummy
Pupil wrote:Dummy wrote:in other words, there is NO return code for calling it. Please read the manual.
I DID THAT! Or why do you think I post this in the FEATURE
REQUEST forum?
Then please tell me another method how to obtain a FREE(=UNUSED) MenuID(NOT EventID) for the Shourtcut
Maybe this might work without the need of an unused id for the return key; just check which window/gadget has the focus when the return key is pressed and you'll know in which priv chat you need to take action..
-.- the shourtcut is sticked to a windowid => it will only occour if the return key is pressed in THAT window

if i create multiple shourtcuts with the same MenuID they override the old ones
=> #PB_Any is NEEDED
@pb: thanks