Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

GUI Req: Local hotkeys


  • Please log in to reply
42 replies to this topic

#21 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,168 posts

Posted 27 March 2005 - 06:31 PM

Yes Ejoc, that's something else that's needed. Being able to pass arguments in HotKeySet, and a GUIHotKeySet of sorts. I still want to see this function become built-in, but, sadly, I haven't seen anybody working on it.







#22 Holger

Holger

    AutoIt Spammer

  • Developers
  • 1,384 posts

Posted 01 April 2005 - 01:22 AM

Ok, I know I have to work on the menucolors/icons :D but however:
I extended the function HotKeySet a little bit to this:
HotKeySet( "key" [, "function" [, WindowHandle Or WindowTitle [, WindowText [,MustBeActive]]]] )
So you could it use like:
Plain Text         
#include <GUIConstants.au3> Dim $cn = 0 $gui    = GUICreate("Test") $label  = GUICtrlCreateLabel("",10,10,250,20) $label2 = GUICtrlCreateLabel("info",10,50,250,20) GUISetState() ; HotKeySet("key" [, "function" [, WindowHandle Or WindowTitle [, WindowText [,MustBeActive]]]] ) ; ; HotKeySet("^s", "HotkeyCheck", $gui, "sssss", 1)  -> OK, cause of special GUI-handle ; HotKeySet("^s", "HotkeyCheck", $gui)              -> OK ; HotKeySet("^s", "HotkeyCheck", "Test, "",0)       -> OK ; HotKeySet("^s", "HotkeyCheck", "Test, "sssss")        -> ERROR ; HotKeySet("^s","HotkeyCheck",$gui,"",1) While 1     $msg = GUIGetMsg()     If $msg = -3 Then ExitLoop WEnd GUIDelete() Exit Func HotkeyCheck()     $cn = $cn + 1     GUICtrlSetData($label,"Script " & $cn & " times saved.") EndFunc

So what do you think about this?
So long...:)
Holger

#23 Ejoc

Ejoc

    What's DllStruct?

  • Active Members
  • PipPipPipPipPipPip
  • 509 posts

Posted 01 April 2005 - 03:31 AM

Sounds great, any chance we can pass arguments to the Function too?
Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

#24 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 01 April 2005 - 05:21 AM

Sounds great, any chance we can pass arguments to the Function too?

<{POST_SNAPBACK}>

I don't see what passing an argument does that using a global variable can't do just as well (That's not condoning the use of global variables, however).

What I think would be more useful is if the callback function could optionally be passed the hotkey combination that was pressed. What I mean by optional is, if the callback function has a signature like this:
Func Callback($variable) EndFunc

Then the hotkey pressed will be passed in and retrievable through $variable. If the signature is in the current form of:
Func Callback() EndFunc

Then no parameter can be passed so none is passed but the callback is still executed.

I do not like the idea of adding macro's to store this kind of information (A @HotKeySet macro or something similar). I think this sort of information should be passed to the function. There's tons of stuff I would like to see passed to GUI OnEvent callback functions, too, so this has more applications than just this one function.

So what I really am asking for is the capability for callback functions to be passed parameters containing useful (and logical) data for the event they are assigned to.

#25 kjactive

kjactive

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 697 posts

Posted 01 April 2005 - 06:23 AM

I agree that an option to do Local accelerators pass to the Gui is a must for future but I would also like to see a option to pass arguments as well, this would make code a lot smaller if one uses the functions as a swits etc. - ofcourse it's posible to do a roundup but that would just not be what I think of when i say AutoIt Gui handle...

AutoIt gui intuitions would grow in future and one window could easely have three or four menu rows and some controls like 10 or 20 and several child windows also with controls - it's just not posible today to add keyboard accelerator support just to a few child windows without a lot of roundups...

Holger I think that your solution is pointing in the right direction...

Kåre

Edited by kjactive, 01 April 2005 - 06:32 AM.


#26 Holger

Holger

    AutoIt Spammer

  • Developers
  • 1,384 posts

Posted 01 April 2005 - 12:19 PM

@Valik: I tried something out and it worked so far (with ugly code) :D
So in my example it would passed: "Test" if I use the declaration with i.e.:
HotKeySet("^s","HotkeyCheck","Test","",1)

So I have to put it then in a separate function.
Instead of going direct to the first the line in the user function we could call the normal "user function parser" you know.
So long... :)
Holger

#27 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,168 posts

Posted 07 May 2005 - 12:37 AM

Okay, so nobody's been to this thread in a while, but I'm resurrecting it anyway. We (Holger that is) have already half-solved the problem of sending parameters with hotkeys, with the @HotKeyPressed macro, but GUI/Window specific hotkeys still haven't been implemented (in beta or otherwise).
In the interim, or perhaps even on a permanent basis... I have created a set of UDFs. I've attached a .zip that contains the UDF's, and some rather sketchy documentation (sorry, I'm just not that good at it). Here's some example code:

Plain Text         
#include <GUIConstants.au3> #include 'HotKeySetLocal.au3' Run('notepad.exe') WinWait('Untitled - Notepad') $hwnd = WinGetHandle('Untitled - Notepad') _HotKeySetLocal($hwnd, '^1', 'Notepad') $gui = GuiCreate('press ctrl+t') $button = GuiCtrlCreateButton('toggle GUI hotkey', 20, 20, 100, 30) GuiSetState() $hk_GUIHotKey = _HotKeySetLocal($gui, '^t', 'ControlT') $i_HKOn = 1 While 1     _HotKeyCheckLocal()     $msg = GUIGetMsg()     If $msg = $GUI_EVENT_CLOSE Then Exit     If $msg = $button Then         If $i_HKOn Then             tooltip('hot key off')             _HotKeyToggleLocal($hk_GUIHotKey, 0)             $i_HKOn = 0         Else             tooltip('hot key on')             _HotKeyToggleLocal($hk_GUIHotKey, 1)             $i_HKOn = 1         EndIf     EndIf WEnd Func Notepad()     Send('This is Notepad. You pressed Ctrl+1.', 1) EndFunc Func ControlT()     MsgBox(0, 'Message', 'You pressed Ctrl+T in the GUI window!') EndFunc


What do you think?

Attached Files


Edited by Saunders, 22 August 2005 - 05:02 AM.


#28 SlimShady

SlimShady

    AutoIt lover

  • Active Members
  • PipPipPipPipPipPip
  • 2,383 posts

Posted 07 May 2005 - 01:38 AM

Okay, so nobody's been to this thread in a while, but I'm resurrecting it anyway. We (Holger that is) have already half-solved the problem of sending parameters with hotkeys, with the @HotKeyPressed macro, but GUI/Window specific hotkeys still haven't been implemented (in beta or otherwise).
In the interim, or perhaps even on a permanent basis... I have created a set of UDFs. I've attached a .zip that contains the UDF's, and some rather sketchy documentation (sorry, I'm just not that good at it). Here's some example code:
[-code-]

What do you think?

<{POST_SNAPBACK}>

It's great that you made the UDFs for us. Thank you for that.
Anyways, I hope you can make this work without UDFs.

Edited by SlimShady, 07 May 2005 - 01:39 AM.


#29 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,168 posts

Posted 09 May 2005 - 12:43 AM

It's great that you made the UDFs for us. Thank you for that.
Anyways, I hope you can make this work without UDFs.

<{POST_SNAPBACK}>

Yes, I can't wait until there is built-in support for these kinds of keys.

#30 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,168 posts

Posted 21 August 2005 - 11:09 PM

* Saunders uses Phoenix Down on thread.
Sorry for the thread revivification, but I was needing this ability again and the workarounds are awfully slow. Has there been any progress in this area? Is it really very difficult to add these local hotkeys?

#31 w0uter

w0uter

    resreveR nA

  • Active Members
  • PipPipPipPipPipPip
  • 2,262 posts

Posted 21 August 2005 - 11:58 PM

Apr 1 2005, 03:22 AM


LOL.
My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

#32 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,168 posts

Posted 22 August 2005 - 04:29 AM

What are you laughing at???

#33 LxP

LxP

    Real satisfaction in every glass.

  • Active Members
  • PipPipPipPipPipPip
  • 1,621 posts

Posted 22 August 2005 - 04:38 AM

Holger's post. <{POST_SNAPBACK}> Not quite sure why.

#34 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,168 posts

Posted 22 August 2005 - 04:57 AM

See, that's what I thought, so I checked Holger's post, but they're different times.
Holger's post: Apr 1 2005, 04:19 AM
w0uter's reference: Apr 1 2005, 03:22 AM
I could see one number being off, but all three?

#35 LxP

LxP

    Real satisfaction in every glass.

  • Active Members
  • PipPipPipPipPipPip
  • 1,621 posts

Posted 22 August 2005 - 05:07 AM

Well according to his profile, w0uter's timezone is 8 hours behind my timezone. So if he refers to a post from Apr 1 2005, 03:22 AM, I need to look at a post from Apr 1 2005, 11:22 AM (which is this one).

Edit: So Saunders, you want the post showing up on your system as Mar 31 2005, 05:22 PM according to your profile.

Edited by LxP, 22 August 2005 - 05:12 AM.


#36 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,168 posts

Posted 22 August 2005 - 05:27 AM

Ahhh right, I wasn't even taking timezones into account.

Wow, I managed to totally derail this thread with all my confusion.

Edit: Even so, I'm still confused as to why.

Edited by Saunders, 22 August 2005 - 05:27 AM.


#37 w0uter

w0uter

    resreveR nA

  • Active Members
  • PipPipPipPipPipPip
  • 2,262 posts

Posted 22 August 2005 - 12:58 PM

i think it was an april's fool joke :whistle:
My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

#38 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,168 posts

Posted 23 August 2005 - 05:11 PM

:whistle: I'd hope not.
I still really want this to come through. Hoping SOMEBODY out there on the developer side of things is looking at this and thinking, "Hey now.. that's an idea."

I'm actually half tempted to start a new topic, but I don't want to be too pushy.

*Edit: Views: 1219 (Just keeping track to see if anybody IS actually checking this thread)

Edited by Saunders, 24 August 2005 - 03:36 AM.


#39 Holger

Holger

    AutoIt Spammer

  • Developers
  • 1,384 posts

Posted 24 August 2005 - 07:47 AM

@Saunders/w0uter: no, this wasn't an april joke :dance:
I started something but since there was an UDF I didn't do anything on this.
I also didn't 'implement' to use the same HotKey on different windows.
Oh, I started a lot of things but nothing is finished :whistle:
When I have time again I will take a look the next days what I did in march and tell you again how it goes on. :dance:
Regards
Holger

#40 SlimShady

SlimShady

    AutoIt lover

  • Active Members
  • PipPipPipPipPipPip
  • 2,383 posts

Posted 29 November 2005 - 04:31 PM

*bump*




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users