Sign in to follow this  
Followers 0
CyberSlug

Image on BS_PUSHLIKE checkbox

9 posts in this topic

#1 ·  Posted (edited)

Can a checkbox with the BS_PUSHLIKE style display an image/icon like ordinary buttons? I'd like to mimic the functionality in the attached screenshot from Visual Basic 6...

GuiCreate("Example...")

GUICtrlCreateCheckbox("I want an image here", 10, 10, 140, 40, 0x1000);BS_PUSHLIKE

GUICtrlCreateButton("button", 60, 60, 40, 40, 0x40);BS_ICON
GuiCtrlSetImage (-1, "shell32.dll",22)

GUICtrlCreateCheckbox("I want an image here", 110, 110, 40, 40, BitOr(0x40, 0x1000))
GuiCtrlSetImage (-1, "shell32.dll",22)

GuiSetState()
While GuiGetMsg() <> -3;$GUI_EVENT_CLOSE    
WEnd

17 Oct 04: I thought I'd remove the attachment to free up some server space. AutoIt has the feature now :)

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Can a checkbox with the BS_PUSHLIKE style display an image/icon like ordinary buttons?  I'd like to mimic the functionality in the attached screenshot from Visual Basic 6...

GuiCreate("Example...")

GUICtrlCreateCheckbox("I want an image here", 10, 10, 140, 40, 0x1000);BS_PUSHLIKE

GUICtrlCreateButton("button", 60, 60, 40, 40, 0x40);BS_ICON
GuiCtrlSetImage (-1, "shell32.dll",22)

GUICtrlCreateCheckbox("I want an image here", 110, 110, 40, 40, BitOr(0x40, 0x1000))
GuiCtrlSetImage (-1, "shell32.dll",22)

GuiSetState()
While GuiGetMsg() <> -3;$GUI_EVENT_CLOSE    
WEnd

<{POST_SNAPBACK}>

I don't think vb is doing what you circle and what you described. VB is the circle is doing the GuiCtrlCreateGroup. :)

I don't understand the power of making a button with a GuiCtrlCreateCheckbox. can you explain? Thanks

Edited by jpm

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I don't think vb is doing what you circle and what you described. VB is the circle is doing the GuiCtrlCreateGroup. :)

I don't understand the power of making a button with a GuiCtrlCreateCheckbox. can you explain? Thanks

<{POST_SNAPBACK}>

The control I selected is "pushed in" to show that it is selected. That is the power of the GuiCtrlCreateCheckbox/BS_PUSHLIKE.

Otherwise, I'll need to create a normal button and change the image depdending on the "button state"...

EDIT: Thanks for the suggestion, Larry. I'll try that.

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

The control I selected is "pushed in" to show that it is selected.  That is the power of the GuiCtrlCreateCheckbox/BS_PUSHLIKE.

Otherwise, I'll need to create a normal button and  change the image depdending on the "button state"...

EDIT:  Thanks for the suggestion, Larry.  I'll try that.

<{POST_SNAPBACK}>

Thanks for the clarification. I was thinking that this State can be handle by a button control with a specific style not with a checkbox.

If not it is easy to to the same as for button for checkbox. :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

The BS_PUSHLIKE style does not work on buttons, and I don't see anything similar :)

My ultimate goal is like this (but with images instead of text):

Global $BS_PUSHLIKE = 0x1000, $GUI_CHECKED = 1
GuiCreate("Choose", 132,234,(@DesktopWidth-132)/2, (@DesktopHeight-234)/2 , 0x04CF0000)

$button_1 = GUICtrlCreateRadio("Cursor", 10, 10, 50, 50, $BS_PUSHLIKE)
$button_2 = GUICtrlCreateRadio("Button", 60, 10, 50, 50, $BS_PUSHLIKE)
$button_3 = GUICtrlCreateRadio("Radio", 10, 60, 50, 50, $BS_PUSHLIKE)
$button_4 = GUICtrlCreateRadio("Chkbox", 60, 60, 50, 50, $BS_PUSHLIKE)
$button_5 = GUICtrlCreateRadio("Label", 10, 110, 50, 50, $BS_PUSHLIKE)
$button_6 = GUICtrlCreateRadio("Edit", 60, 110, 50, 50, $BS_PUSHLIKE)
$button_7 = GUICtrlCreateRadio("List", 10, 160, 50, 50, $BS_PUSHLIKE)
$button_8 = GUICtrlCreateRadio("Combo", 60, 160, 50, 50, $BS_PUSHLIKE)

GuiCtrlSetState($button_1, $GUI_CHECKED)
GuiSetState()

While GuiGetMsg() <> -3
WEnd
Exit
Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@Jon: it should be no problem to add the "checkbox" to the CtrlSetImage-function :) (I tested it and it works)

@Jon: if Jon makes a change then you could it use your lines like you did:

GUICtrlCreateCheckbox("I want an image here", 110, 110, 40, 40, BitOr($BS_ICON, $BS_PUSHLIKE))
GuiCtrlSetImage (-1, "shell32.dll",22)

Regards Holger

Edit: forgot something: @Jon: could you please change the maximum menuitem creation parameters to 4?

The 4th is the setting of a radiomenuitem (1 = radio, other = normal menuitem).

It is already in the creation function, only 3 have to change to 4 ;)

Thanks :)

Edited by Holger

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

The BS_PUSHLIKE style does not work on buttons, and I don't see anything similar :)

My ultimate goal is like this (but with images instead of text):

Global $BS_PUSHLIKE = 0x1000, $GUI_CHECKED = 1
GuiCreate("Choose", 132,234,(@DesktopWidth-132)/2, (@DesktopHeight-234)/2 , 0x04CF0000)

$button_1 = GUICtrlCreateRadio("Cursor", 10, 10, 50, 50, $BS_PUSHLIKE)
$button_2 = GUICtrlCreateRadio("Button", 60, 10, 50, 50, $BS_PUSHLIKE)
$button_3 = GUICtrlCreateRadio("Radio", 10, 60, 50, 50, $BS_PUSHLIKE)
$button_4 = GUICtrlCreateRadio("Chkbox", 60, 60, 50, 50, $BS_PUSHLIKE)
$button_5 = GUICtrlCreateRadio("Label", 10, 110, 50, 50, $BS_PUSHLIKE)
$button_6 = GUICtrlCreateRadio("Edit", 60, 110, 50, 50, $BS_PUSHLIKE)
$button_7 = GUICtrlCreateRadio("List", 10, 160, 50, 50, $BS_PUSHLIKE)
$button_8 = GUICtrlCreateRadio("Combo", 60, 160, 50, 50, $BS_PUSHLIKE)

GuiCtrlSetState($button_1, $GUI_CHECKED)
GuiSetState()

While GuiGetMsg() <> -3
WEnd
Exit

<{POST_SNAPBACK}>

When I say State I mean Style as you understand. So if there is no style i will send change for checkbox with image to JON.

EDIT: the easiest modification just one C line to add in CtrlSetImage but $BS_PUSHLIKE+$BS_ICON needed

Edited by jpm

Share this post


Link to post
Share on other sites

Make sure to also upload the change for radio buttons :)

<{POST_SNAPBACK}>

for sure tha's first in modification line :)

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