Jump to content
Sign in to follow this  
empty75

Radios & Check Boxes

Recommended Posts

empty75

I am using latest autoit 3.2.10

I have a gui with several radio buttons,

hidden and disabled in the same position are several check boxes.

When i click a button it is supposed to disable/hide the radios and enable/show the check boxes

Click the other button and they switch round.

When the check boxes are displayed all is ok,

but when the radios are displayed and you roll mouse over to select a radio button the display corrupts and displays the underlying checkbox.

Below is a small section i am having trouble with from a much larger script

CODE

#include <GuiConstants.au3> ; Call Gui functions

;The GUI Install *********************

$GuiInstall = GuiCreate ("Test Checkboxes and Radios" , 460, 460)

GuiSetBkColor(0XFFFFFF)

$chk1 = GUICtrlCreateCheckbox ("Action", 110, 25)

$chk2 = GUICtrlCreateCheckbox ("Breakout", 200, 25)

$chk3 = GUICtrlCreateCheckbox ("Card", 280, 25)

$chk4 = GUICtrlCreateCheckbox ("Multi", 200, 45)

$chk5 = GUICtrlCreateCheckbox ("Puzz", 110, 65)

$chk6 = GUICtrlCreateCheckbox ("Shooter", 200, 65)

$chk7 = GUICtrlCreateCheckbox ("Strat", 280, 45)

For $i = 1 To 7 ;disables and hides all check buttons

GUICtrlSetState ( Eval("chk_" & $i), $GUI_Disable + $GUI_Hide)

Next

$CatGroupMsg = "The Game Category: "

$rad_1 = GUICtrlCreateRadio ("Action", 110, 25)

$rad_2 = GUICtrlCreateRadio ("Breakout", 200, 25)

$rad_3 = GUICtrlCreateRadio ("Card", 280, 25)

$rad_4 = GUICtrlCreateRadio ("Multi", 200, 45)

$rad_5 = GUICtrlCreateRadio ("Puzz", 110, 65)

$rad_6 = GUICtrlCreateRadio ("Shooter", 200, 65)

$rad_7 = GUICtrlCreateRadio ("Strat", 280, 45)

For $i = 1 To 7 ;enable all radio buttons

GUICtrlSetState ( Eval("rad_" & $i), $GUI_Enable + $GUI_Show + $GUI_ONTOP)

Next

$Tocheckers = GUICtrlCreateButton ( "check", 20, 320, 80, 30)

$toradio = GUICtrlCreateButton ( "radio", 20, 360, 80, 30)

GUISetState(@SW_SHOW, $GuiInstall)

While 1

$msg = GUIGetMsg() ; get the event message from the form

Select

Case $msg = $tocheckers

For $i = 1 To 7 ;disables and hides all radio buttons

GUICtrlSetState ( Eval("rad_" & $i), $GUI_Disable + $GUI_Hide)

Next

For $i = 1 To 7 ;display check buttons

GUICtrlSetState ( Eval("chk_" & $i), $GUI_Enable + $GUI_Show + $GUI_ONTOP)

Next

Case $msg = $toradio

;change back to default settings

For $i = 1 To 7 ;show all radio buttons

GUICtrlSetState ( Eval("rad_" & $i), $GUI_Enable + $GUI_Show + $GUI_ONTOP)

Next

GuiCtrlSetState($rad_7, $GUI_Checked)

For $i = 1 To 7 ;disables and hides all check buttons

GUICtrlSetState ( Eval("chk_" & $i), $GUI_Disable + $GUI_Hide)

Next

EndSelect

Wend

It doesn't matter if the radios are in a group or not it still mucks up when i try to display the radio buttons.

Any suggestions or is this a bug?

Thanks.

Matthew

Share this post


Link to post
Share on other sites
GEOSoft

I am using latest autoit 3.2.10

I have a gui with several radio buttons,

hidden and disabled in the same position are several check boxes.

When i click a button it is supposed to disable/hide the radios and enable/show the check boxes

Click the other button and they switch round.

When the check boxes are displayed all is ok,

but when the radios are displayed and you roll mouse over to select a radio button the display corrupts and displays the underlying checkbox.

Below is a small section i am having trouble with from a much larger script

CODE

#include <GuiConstants.au3> ; Call Gui functions

;The GUI Install *********************

$GuiInstall = GuiCreate ("Test Checkboxes and Radios" , 460, 460)

GuiSetBkColor(0XFFFFFF)

$chk1 = GUICtrlCreateCheckbox ("Action", 110, 25)

$chk2 = GUICtrlCreateCheckbox ("Breakout", 200, 25)

$chk3 = GUICtrlCreateCheckbox ("Card", 280, 25)

$chk4 = GUICtrlCreateCheckbox ("Multi", 200, 45)

$chk5 = GUICtrlCreateCheckbox ("Puzz", 110, 65)

$chk6 = GUICtrlCreateCheckbox ("Shooter", 200, 65)

$chk7 = GUICtrlCreateCheckbox ("Strat", 280, 45)

For $i = 1 To 7 ;disables and hides all check buttons

GUICtrlSetState ( Eval("chk_" & $i), $GUI_Disable + $GUI_Hide)

Next

$CatGroupMsg = "The Game Category: "

$rad_1 = GUICtrlCreateRadio ("Action", 110, 25)

$rad_2 = GUICtrlCreateRadio ("Breakout", 200, 25)

$rad_3 = GUICtrlCreateRadio ("Card", 280, 25)

$rad_4 = GUICtrlCreateRadio ("Multi", 200, 45)

$rad_5 = GUICtrlCreateRadio ("Puzz", 110, 65)

$rad_6 = GUICtrlCreateRadio ("Shooter", 200, 65)

$rad_7 = GUICtrlCreateRadio ("Strat", 280, 45)

For $i = 1 To 7 ;enable all radio buttons

GUICtrlSetState ( Eval("rad_" & $i), $GUI_Enable + $GUI_Show + $GUI_ONTOP)

Next

$Tocheckers = GUICtrlCreateButton ( "check", 20, 320, 80, 30)

$toradio = GUICtrlCreateButton ( "radio", 20, 360, 80, 30)

GUISetState(@SW_SHOW, $GuiInstall)

While 1

$msg = GUIGetMsg() ; get the event message from the form

Select

Case $msg = $tocheckers

For $i = 1 To 7 ;disables and hides all radio buttons

GUICtrlSetState ( Eval("rad_" & $i), $GUI_Disable + $GUI_Hide)

Next

For $i = 1 To 7 ;display check buttons

GUICtrlSetState ( Eval("chk_" & $i), $GUI_Enable + $GUI_Show + $GUI_ONTOP)

Next

Case $msg = $toradio

;change back to default settings

For $i = 1 To 7 ;show all radio buttons

GUICtrlSetState ( Eval("rad_" & $i), $GUI_Enable + $GUI_Show + $GUI_ONTOP)

Next

GuiCtrlSetState($rad_7, $GUI_Checked)

For $i = 1 To 7 ;disables and hides all check buttons

GUICtrlSetState ( Eval("chk_" & $i), $GUI_Disable + $GUI_Hide)

Next

EndSelect

Wend

It doesn't matter if the radios are in a group or not it still mucks up when i try to display the radio buttons.

Any suggestions or is this a bug?

Thanks.

Matthew

Although I do use Eval on occasion it is not always appropriate.

First change your for/next loops to

For $I = $chk1 TO $chk7

and

For $I = $rad_1 TO $rad_7

Then I would remove the GUI constants and replace them with the proper values

to show and enable it will be 80

for hide and disable it will be 160

Example

Case $msg = $tocheckers
   For $I = $rad_1 TO $rad_7;disables and hides all radio buttons
      GUICtrlSetState ( $I, 160)
   Next

   For $i = $I = $chk1 TO $chk7;display check buttons
      GUICtrlSetState ( $i, 80)
   Next

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
GEOSoft

Not sure why this works, but it does.

Thanks.

Matthew.

It probably had to do with the $GUI_ONTOP which I removed.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.