Sign in to follow this  
Followers 0
Ármányos Kő

They are not identical! Operation through Hotkeyset or GUI button...

5 posts in this topic

Hi,

I have a pretty complex Toolbarset for FrameMaker (old document designer software).

I added some new feature and used Hotkeyset while testing. When everything was OK, I configured my already existing toolbar with a new button.

BUT THIS STOPPED my new feature to work!!!

I have a GUI which has 3 buttons each running a given Func.

Here is what works perfectly:

(Only the main things are copied here, unnecessary things are left out...)

HotKeySet("{F10}", "minusing")  ; hotkey for this new feature


While 1
    Sleep(100) ; My general cycle to run my Toolbar in one document processor software
WEnd

Func minusing()
    ; make one window with three buttons for operation
    #Region ### START Koda GUI section ### Form=E:\munka\magam\AutoIt\05 FMtores\source\minuszkereses.kxf
    Global $minuszkeres = GUICreate("Minus positioning", 403, 55, 810, 795, BitOR($WS_DLGFRAME,$WS_CLIPSIBLINGS,$DS_SETFOREGROUND), BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
    Global $minusz_tovabb_gomb = GUICtrlCreateButton("Find next!", 8, 8, 89, 25, 0)
    GUICtrlSetOnEvent($minusz_tovabb_gomb, "Find_next")     ; Function 1 to call
    Global $minusz_legyen_gomb = GUICtrlCreateButton("Make it a minus!", 136, 8, 129, 25, 0)
    GUICtrlSetOnEvent($minusz_legyen_gomb, "minus_moving")   ; Function 2 to call
    Global $minusz_vege_gomb = GUICtrlCreateButton("Finish this stuff", 296, 8, 97, 25, 0)
    GUICtrlSetOnEvent($minusz_vege_gomb, "minus_end")        ; Function 3 to call
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    
    While 2 
;~      Wait for above buttons to be pressed...
        Sleep(100)
        If $minuszkeres_fut = False Then ExitLoop
    WEnd
Endfunc

Func Find_next() ; Function 1 
    Controlclick("Find/Change", "", "Button9")  ; a Find next button in an existing window
EndFunc
Func minus_end()
    $minuszkeres_fut = False            ; to end While 2 cycle above
    GUIDelete($minuszkeres)
EndFunc
Func minus_moving()
    MsgBox(0,"I do", "some complex tasks here...")
EndFuncoÝ÷ Ø Ý¶¬v¬]¡©ò¶§^»­¶ìj·©­ë,yÕ¡zw%¢È§lP­²ç]zyr²Ö«¶Çhx,¢g©j»l¡ù²ªê-r©ìl¶çߪê-&éÜ)î²j/xºÚ"µÍÈÛÛÜX][ÛÌÍÝÛÛHÕRPÜX]J   ][ÝÑH=ºÉ][ÝË
LÍ
M
MÌÍK  ÌÍÕÔ×ÔÔT
ÉÌÍÕÔ×ÐÔT   ÌÍÕÔ×ÑVÕÔSÔÕ
ÉÌÍÕÔ×ÑVÕÓÓÒSÕÊHÌÍÛZ[Þ[[Y^]ÛHÕRPÝÜX]P]Û
    ][ÝÉ][ÝË    ÌÍÐ×ÐUPT
BÕRPÝÙ][XYÙJ    ÌÍÛZ[Þ[[Y^]ÛØÜ[É][ÝÉÌLÚXÛÛÉÌLÛZ[Þ[[Y^ ][ÝÊBÕRPÝÙ]
LK  ][ÝÓZ[[Z[Þ[YYÚÙúÙH:ÈÛÜZÝ[[Y^ºÜH[Z¸[8É][ÝÊBÕRPÝÙ]Û][
LK  ][ÝÛZ[Ú[É][ÝÊHÈ[Ý[ÛÈØ[Ú[HBTÛY
L
HÈ^HÙ[[ÞXÛHÈ[^HÛÛ[ÛHØÝ[Y[ØÙÜÛÜÛÙØBÑ[[ÈZ[Ú[Ê
BNÈXZÙHÛHÚ[ÝÈÚ]YH]ÛÈÜÜ][ÛHÔYÚ[ÛÈÈÈÕTÛÙHÕRHÙXÝ[ÛÈÈÈÜOQNÌLÛ][ØIÌLÛXYØ[IÌLÐ]]Ò]  ÎLÉÍÍH]ÜÉÌLÜÛÝÙIÌLÛZ[ÞÙÙËÞQÛØ[  ÌÍÛZ[ÞÙÈHÕRPÜX]J    ][ÝÓZ[ÈÜÚ][Û[É][ÝË
Ë
MKL
ÎMK]Ô ÌÍÕÔ×ÑÑSQK   ÌÍÕÔ×ÐÓTÒPSÔË ÌÍÑ×ÔÑUÔQÔÕS
K]Ô    ÌÍÕÔ×ÑVÕÓÓÒSÕË  ÌÍÕÔ×ÑVÕÔSÔÕ  ÌÍÕÔ×ÑVÕÒSÕÑQÑJJBQÛØ[  ÌÍÛZ[ÞÝÝXÙÛÛXHÕRPÝÜX]P]Û   ][ÝÑ[^    ÌÌÎÉ][ÝËKK
BQÕRPÝÙ]Û][
    ÌÍÛZ[ÞÝÝXÙÛÛX  ][ÝÑ[Û^  ][ÝÊHÈ[Ý[ÛHÈØ[QÛØ[ ÌÍÛZ[ÞÛYÞY[ÙÛÛXHÕRPÝÜX]P]Û ][ÝÓXZÙH]HZ[ÉÌÌÎÉ][ÝËLÍLKK
BQÕRPÝÙ]Û][
    ÌÍÛZ[ÞÛYÞY[ÙÛÛX    ][ÝÛZ[×Û[Ý[É][ÝÊHÈ[Ý[ÛÈØ[QÛØ[    ÌÍÛZ[ÞÝYÙWÙÛÛXHÕRPÝÜX]P]Û  ][ÝÑ[ÚÈÝY][ÝËMMËK
BQÕRPÝÙ]Û][
    ÌÍÛZ[ÞÝYÙWÙÛÛX ][ÝÛZ[×Ù[   ][ÝÊHÈ[Ý[ÛÈÈØ[QÕRTÙ]Ý]JÕ×ÔÒÕÊBHÑ[YÚ[ÛÈÈÈSÛÙHÕRHÙXÝ[ÛÈÈÂBUÚ[HßBUØZ]ÜXÝH]ÛÈÈHÜÙYBTÛY
L
BBRY    ÌÍÛZ[ÞÙ×Ù]H[ÙH[^]ÛÜUÑ[[[Â[È[Û^

HÈ[Ý[ÛHPÛÛÛÛXÚÊ    ][ÝÑ[ÐÚ[ÙI][ÝË   ][ÝÉ][ÝË    ][ÝÐ]ÛI][ÝÊHÈH[^]Û[[^Ý[ÈÚ[ÝÂ[[Â[ÈZ[×Ù[

BIÌÍÛZ[ÞÙ×Ù]H[ÙBBBNÈÈ[Ú[HÞXÛHXÝBQÕRQ[]J  ÌÍÛZ[ÞÙÊB[[Â[ÈZ[×Û[Ý[Ê
BSÙÐÞ
    ][ÝÒHÉ][ÝË ][ÝÜÛÛYHÛÛ^ÚÜÈK][ÝÊB[[

I am totally without ideas on this.

Everything else is in perfect order with other functions, buttons, whatevers....

There must be something to do with the GuiCtrlSetOnEvent in the Toolbar creation, not???

Share this post


Link to post
Share on other sites



Have you set this opt?

Opt("GUIonEventMode", 1)
Yes, it's set like that.

Share this post


Link to post
Share on other sites

Yes, it's set like that.

So, if anyone happen to see the same problem, here is the clue:

From help file: "A hotkey-press *typically* interrupts the active AutoIt function/statement and runs its user function until it completes or is interrupted."

The same function invoked from a button on a toolbar does not work the same way, the main thread is not interrupted. This is why nesting two While cycle did not work for button, but did work for Hotkey.

Share this post


Link to post
Share on other sites

While 2 
;~   Wait for above buttons to be pressed...
        Sleep(100)
        If $minuszkeres_fut = False Then ExitLoop
    WEnd

And 2 is what? Or what is 2?


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0