#PB_Any support for AddKeyboardShortcut()!

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

#PB_Any support for AddKeyboardShortcut()!

Post 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!
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post by Dummy »

Fread doesn't like me! :cry:

He never answers to my requests :cry:
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

he is on vacation.
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post by Dummy »

since Tue Jun 14, 2005 14:09?
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post 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???
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

PB_Any need to be supported where it is not, here and in the menu items for example.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

but why here???
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post 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?!?
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post 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 :))
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: #PB_Any support for AddKeyboardShortcut()!

Post 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post 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
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

lol, PB :lol:
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 :lol:
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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! :oops:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post 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..
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post 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 :evil:
if i create multiple shourtcuts with the same MenuID they override the old ones :evil:
=> #PB_Any is NEEDED

@pb: thanks
Last edited by Dummy on Sat Sep 17, 2005 11:16 am, edited 1 time in total.
Post Reply