Jump to content

Disable button style but still able to use button?


Recommended Posts

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?

 

Link to comment
Share on other sites

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

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

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

 

Link to comment
Share on other sites

; 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
Link to comment
Share on other sites

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