Sign in to follow this  
Followers 0
Chimaera

Disable button style but still able to use button?

6 posts in this topic

Hi all

Im working on a gui that i need to show that a button has been used before but still allows it to be used again

Local $hButton_1 = GUICtrlCreateButton( "", 25, 30, 45, 45, $BS_BITMAP, $WS_EX_WINDOWEDGE)
    GUICtrlSetImage($hButton_1,  $templocation & 'simplestart_img.bmp')

im creating the button like this

And i want it to go grey like this when you disable them

GUICtrlSetState($hButton_1, $GUI_DISABLE)

But i still want the button usable so not disabled.

So to recap it needs to be greyed out like the disable but still accessible  so it can be used

Is there a simple way to do this?

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

A Button with State $GUI_Disable is disabled. You can only try to give him a look like diabled. Try GuiCtrlSetBKColor and GuiCtrlSetBColor. You must also create a 2. bmp using in the "LookLikeDiabled"-State.

Edited by AutoBert

Share this post


Link to post
Share on other sites

On iPad, excuse typos and briefness. Leave button enabled but set button text color to purple like html links already visited. For better consistency, instead of button use blue underlined label.

Share this post


Link to post
Share on other sites
4 hours ago, AutoBert said:

A Button with State $GUI_Disable is disabled. You can only try to give him a look like diabled. Try GuiCtrlSetBKColor and GuiCtrlSetBColor. You must also create a 2. bmp using in the "LookLikeDiabled"-State.

Ok thx ill have a look at doing that.

What is the 2.bmp? a second version of the button?

I was considering that path but it doubles the button bmps i have to include

3 hours ago, orbs said:

On iPad, excuse typos and briefness. Leave button enabled but set button text color to purple like html links already visited. For better consistency, instead of button use blue underlined label.

Unfortunatly they are all pictures with no text.

 

Ill keep playing thx for the help

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

; Johnmcloud - 2016
#include <GUIConstantsEx.au3>

$hGUI = GUICreate("", 180, 104, -1, -1)
$Button = GUICtrlCreateButton("Click Me", 24, 16, 137, 65)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    $aInfo = GUIGetCursorInfo($hGUI)
    If IsArray($aInfo) And $aInfo[2] = 1 Then ; Primary down (1 if pressed, 0 if not pressed)
        Select
            Case $aInfo[4] = $Button ; ID of the control that the mouse cursor is hovering over (or 0 if none)
                _MouseRelease()
                ConsoleWrite("!Button clicked" & @CRLF)
        EndSelect
    EndIf
WEnd

Func _MouseRelease()
    Do
        $aInfo = GUIGetCursorInfo($hGUI)
        Sleep(10)
    Until $aInfo[2] = 0 ; Primary down - wait for release 0 if not pressed
EndFunc   ;==>_MouseRelease

Think outside of the box!

Edited by johnmcloud

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

A little simpler

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("", 180, 104, -1, -1)
$Button = GUICtrlCreateButton("Click Me", 24, 16, 137, 65)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            Msgbox(0,"", "Button clicked enabled")
            GUICtrlSetState($Button, $GUI_DISABLE)
        Case $GUI_EVENT_PRIMARYUP
            If GUIGetCursorInfo()[4] = $Button Then Msgbox(0,"", "Button clicked disabled")
    EndSwitch
 WEnd

 

Edited by mikell
typo

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