Jump to content

Default Button, not so default


Recommended Posts

So, let's say I have a button:

$Send = GUICtrlCreateButton("Send", 550, 550, 57, 53, $BS_DEFPUSHBUTTON)
GUICtrlSetState($EditSend, $GUI_FOCUS)

And then i have some more buttons:

$imgButton = GuiCtrlCreateButton("IMG", 8, 603, 20, 20, $BS_BITMAP)
GUICtrlSetImage(-1, "image.bmp")
$codeButton = GuiCtrlCreateButton("<>", 28, 603, 20, 20, $BS_BITMAP)
GUICtrlSetImage(-1, "code.bmp")
$linkButton = GuiCtrlCreateButton("Link", 48, 603, 20, 20, $BS_BITMAP)
GUICtrlSetImage(-1, "link.bmp")
$emailButton = GuiCtrlCreateButton("@", 68, 603, 20, 20, $BS_BITMAP)
GUICtrlSetImage(-1, "email.bmp")
$quoteButton = GuiCtrlCreateButton('""', 88, 603, 20, 20, $BS_BITMAP)
GUICtrlSetImage(-1, "quote.bmp")

Note, that the other buttons are not default. If, when i press one of the OTHER buttons, the default stays at that other button, and not the REAL default.

Note, when I call my routines:

Case $codeButton
            $OpenTag = "[" & "code]"
            $CloseTag = "[" & "/code]"
            Replace_MySelection()
    GUICtrlSetState($EditSend, $GUI_FOCUS)

I do reset the focus back to the edit send. But, how does one reset the button back to the main pushbutton? Should i make it do something like this:

Case $codeButton
            $OpenTag = "[" & "code]"
            $CloseTag = "[" & "/code]"
            Replace_MySelection()
    GUICtrlSetState($Send, $GUI_FOCUS)
    GUICtrlSetState($EditSend, $GUI_FOCUS)

Would that work?

Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

So, let's say I have a button:

$Send = GUICtrlCreateButton("Send", 550, 550, 57, 53, $BS_DEFPUSHBUTTON)
GUICtrlSetState($EditSend, $GUI_FOCUS)oÝ÷ Ø  ݶ§¯zÊ&zj+y»­¶ìjëh×6$imgButton = GuiCtrlCreateButton("IMG", 8, 603, 20, 20, $BS_BITMAP)
GUICtrlSetImage(-1, "image.bmp")
$codeButton = GuiCtrlCreateButton("<>", 28, 603, 20, 20, $BS_BITMAP)
GUICtrlSetImage(-1, "code.bmp")
$linkButton = GuiCtrlCreateButton("Link", 48, 603, 20, 20, $BS_BITMAP)
GUICtrlSetImage(-1, "link.bmp")
$emailButton = GuiCtrlCreateButton("@", 68, 603, 20, 20, $BS_BITMAP)
GUICtrlSetImage(-1, "email.bmp")
$quoteButton = GuiCtrlCreateButton('""', 88, 603, 20, 20, $BS_BITMAP)
GUICtrlSetImage(-1, "quote.bmp")oÝ÷ ØÚ-zØZ¶Ø^¢Ø^­»­¶ìj·§¢×^}«¥´ðé⦷¬²Þ¡ûaxäÇî¶Ú'²Ø^uçÚº[lµ¬¬jÛajÚ-êÛºÛh©ÝmäD·^}«¥´Ú-{^Y²®­w¬jëh×6        Case $codeButton
            $OpenTag = "[" & "code]"
            $CloseTag = "[" & "/code]"
            Replace_MySelection()
    GUICtrlSetState($EditSend, $GUI_FOCUS)oÝ÷ Øh­ë¶Ø^~.±¶Ú-çÛÐn¶0v¬¢w«zÇ­¶ºÛh¶Ú-ézn²î¶Ú'J.ئjG¢µÚ,¢g­)à)¶¬jëh×6        Case $codeButton
            $OpenTag = "[" & "code]"
            $CloseTag = "[" & "/code]"
            Replace_MySelection()
    GUICtrlSetState($Send, $GUI_FOCUS)
    GUICtrlSetState($EditSend, $GUI_FOCUS)

Would that work?

You have been setting the focus to $EditSend when I think you want $send.

BW if your code looks all messed up in this reply, it's because you used those bloody autoit tags. Normaly I wouldn't even reply to this message because of it.

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!"

Link to comment
Share on other sites

You have been setting the focus to $EditSend when I think you want $send.

BW if your code looks all messed up in this reply, it's because you used those bloody autoit tags. Normaly I wouldn't even reply to this message because of it.

As to the autoit tags, i keep forgetting to use /code haha, i'll get that fixed later.

The reason why I use $EditSend is because it changes the focus back to the edit box sot he client's don't have to constantly keep clicking on it.

Note, if i change the buttons to images, (with the exception of the 'send' button), the default send button works just fine, but i can't do that because of another requirement in my script :D

How can i force the $send button to be default no matter what?

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

por que?

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

From the help file:

#include <ButtonConstants.au3>

$BS_DEFPUSHBUTTON = 0x0001

Creates a push button with a heavy black border. If the button is in a dialog box, the user can select the button by pressing the ENTER key, even when the button does not have the input focus. This style is useful for enabling the user to quickly select the most likely option, or default.

So, is your GUI a dialog box?

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

From the help file:

So, is your GUI a dialog box?

:D

I'm actually gonna not really follow up on this individual post only because i asked it better in another post. But no, my GUi is a complete chat application, that'd be kinda silly to put in a dialog box :D BUt that still doesn't negate the fact that i want the button to be default; there has to be some method to do this.

But like i said, this topic is better off deleted as i'm following it in another thread.

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...