Jump to content

Un-selecting Button - Please help


Wolvereness
 Share

Recommended Posts

I have a script that creates a large number of boxes:

For $CountA = 1 To 20
    For $CountB = 1 To 60
        $Buttons[$CountA][$CountB] = GUICtrlCreateButton('', ($CountA - 1) * 30, ($CountB - 1) * 10, 30, 10, 0x8c00)
    Next
Next

I need a snippet of code to un-select the given box.

This is what I currently have:

Do
    For $CountA = 1 To 20
        For $CountB = 1 To 60
            If $msg = $Buttons[$CountA][$CountB] Then ExitLoop (3)
        Next
    Next
    MsgBox(0, 'Error', 'Could not decipher $msg')
    Exit
Until 1
If GUICtrlRead($Buttons[$CountA][$CountB]) = '' Then
    GUICtrlSetData($Buttons[$CountA][$CountB], '111111111111111')
ElseIf GUICtrlRead($Buttons[$CountA][$CountB]) = '111111111111111' Then
    GUICtrlSetData($Buttons[$CountA][$CountB], '222222222222222')
ElseIf GUICtrlRead($Buttons[$CountA][$CountB]) = '222222222222222' Then
    GUICtrlSetData($Buttons[$CountA][$CountB], '333333333333333')
ElseIf GUICtrlRead($Buttons[$CountA][$CountB]) = '333333333333333' Then
    GUICtrlSetData($Buttons[$CountA][$CountB], '444444444444444')
ElseIf GUICtrlRead($Buttons[$CountA][$CountB]) = '444444444444444' Then
    GUICtrlSetData($Buttons[$CountA][$CountB], '555555555555555')
ElseIf GUICtrlRead($Buttons[$CountA][$CountB]) = '555555555555555' Then
    GUICtrlSetData($Buttons[$CountA][$CountB], '888888888888888')
ElseIf GUICtrlRead($Buttons[$CountA][$CountB]) = '888888888888888' Then
    GUICtrlSetData($Buttons[$CountA][$CountB], '')
Else
    MsgBox(0, 'Error', 'Could not decipher the box')
EndIf

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

You can use Checkbox with $BS_PUSHLIKE style like alternative...

Look this little example:

#include <GuiConstants.au3>
GuiCreate("Sample", 392, 323)

GuiCtrlCreateCheckbox("", 90, 40, 80, 50, $BS_PUSHLIKE)
GuiCtrlCreateCheckbox("", 90, 100, 80, 60, $BS_PUSHLIKE)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Link to comment
Share on other sites

No I can't... I must have these boxes because of the way they look.

/Edit What I am trying to do is remove the box around the button that is created when pressed.

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

No I can't... I must have these boxes because of the way they look.

/Edit What I am trying to do is remove the box around the button that is created when pressed.

<{POST_SNAPBACK}>

Are you talking about the line that shows up around the control showing the focus is on it? If so, can't you use

GUICtrlSetState($controlname, $GUI_Focus)

on another Control on the GUI? Like maybe a label?

We have enough youth. How about a fountain of SMART?

Link to comment
Share on other sites

Screen shot of what I want to get rid of. FYI, the blue!

2 - I think

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

#include <GuiConstants.au3>

GuiCtrlSetState($refOfSomeOtherControl, $GUI_DEFBUTTON)

<{POST_SNAPBACK}>

$DefButton or $Focus don't work... It wont remove the box first time box is clicked. When I click a box a second time it works. It's like every other time it works...

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

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...