Jump to content

how to create the Lightweight command buttons


DXRW4E
 Share

Recommended Posts

Perhaps look at the _GUICtrlButton_*** Functions in the Help file,

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Why not use GUICtrlCreateLabel and then monitor using GUIGetMsg() when the user clicks on the label e.g.

#include <GUIConstantsEx.au3>

_Main()

Func _Main()
    Local $iCancel, $iOK

    GUICreate("Alternative CommandLink", 500, 200)
    $iOK = GUICtrlCreateLabel("Yes - Select to continue.", 5, 10, 490, 35)
    GUICtrlSetFont(-1, 20)
    $iCancel = GUICtrlCreateLabel("No - Select to stop.", 5, 70, 490, 35)
    GUICtrlSetFont(-1, 20)
    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $iCancel
                Exit

            Case $iOK
                MsgBox(64, "OK", "You selected 'Yes'")
        EndSwitch
    WEnd
EndFunc   ;==>_Main
Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Hi guinness, thanks for the answer, will be able to do so also

#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
    Local $hImage, $btn, $btn2, $Test


    GUICreate("Buttons", 400, 266, 192, 124)

    $Test = GUICtrlCreateLabel("ABCDEFGHIECTECTEC", 80, 24, 272, 33)

    $hImage = _GUIImageList_Create(1, 1, 5, 3, 6)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 11111)

    $btn = GUICtrlCreateButton("Button1", 35, 20, 99, 41, $BS_COMMANDLINK)
    _GUICtrlButton_SetImageList($btn, $hImage)

    $btn2 = GUICtrlCreateButton("Button2", 35, 80, 99, 41, $BS_COMMANDLINK)
    _GUICtrlButton_SetImageList($btn2, $hImage)

    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    Exit
EndFunc   ;==>_Main

but not the same thing again, having the Lightweight command buttons it would be really nice, will be able to be an used to create a button or some other (imitating ribbon style ect ect) instead comandlink button not the lying thing

I see that in a Web there is not much information about Lightweight command buttons hmmmmm

Ciao.

Edited by DXRW4E

apps-odrive.pngdrive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

Link to comment
Share on other sites

Maybe something like this?

#include <GUIConstantsEx.au3>
#include <GuiButton.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
Local $hButton1, $hButton2

GUICreate("Buttons", 400, 300)

$hButton1 = GUICtrlCreateButton("Button1", 50, 50, 200, 100, $BS_COMMANDLINK)
DllCall("user32.dll", "UINT", "SendMessage", "handle", GUICtrlGetHandle($hButton1), "UINT", $BCM_SETNOTE, "ptr*", 0, "wstr", "Here comes some description of the button no.1 and bla, bla, bla")
DllCall("user32.dll", "UINT", "SendMessage", "handle", GUICtrlGetHandle($hButton1), "UINT", $BCM_SETSHIELD, "ptr*", 0, "BOOL", True)

$hButton2 = GUICtrlCreateButton("Button2", 50, 150, 300, 100, $BS_COMMANDLINK)
DllCall("user32.dll", "UINT", "SendMessage", "handle", GUICtrlGetHandle($hButton2), "UINT", $BCM_SETNOTE, "ptr*", 0, "wstr", "Here comes some description of the button no.2 and bla, bla, bla again")
DllCall("user32.dll", "UINT", "SendMessage", "handle", GUICtrlGetHandle($hButton2), "UINT", $BCM_SETSHIELD, "ptr*", 0, "BOOL", False)

GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $hButton1
MsgBox(0, "", "Button 1 pressed!")
Case $hButton2
MsgBox(0, "", "Button 2 pressed!")
EndSwitch
WEnd
EndFunc   ;==>_Main
Link to comment
Share on other sites

Interesting taietel, nice.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Hi taietel, thanks for the reply (a really nice example) I know what it is, for this or said that "BS_COMMANDLINK" is not equal to "Lightweight command buttons", the "Lightweight command buttons" is another thing

Posted Image

sorry again for my English

Ciao.

apps-odrive.pngdrive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

Link to comment
Share on other sites

taietel,

Just looked more into the code why not use _GUICtrlButton_SetNote() & _GUICtrlButton_SetShield()?

#include <GUIButton.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
    Local $iButton_1, $iButton_2

    GUICreate("Buttons", 400, 300)

    $iButton_1 = GUICtrlCreateButton("Button1", 50, 50, 200, 100, $BS_COMMANDLINK)
    _GUICtrlButton_SetNote(GUICtrlGetHandle($iButton_1), "Description of Button_1.")
    _GUICtrlButton_SetShield(GUICtrlGetHandle($iButton_1), True)

    $iButton_2 = GUICtrlCreateButton("Button2", 50, 150, 300, 100, $BS_COMMANDLINK)
    _GUICtrlButton_SetNote(GUICtrlGetHandle($iButton_2), "Description of Button_2.")
    _GUICtrlButton_SetShield(GUICtrlGetHandle($iButton_2), True)
    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit

            Case $iButton_1
                MsgBox(0, "", "Button 1 pressed!")

            Case $iButton_2
                MsgBox(0, "", "Button 2 pressed!")

        EndSwitch
    WEnd
EndFunc   ;==>_Main
Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

We've both learnt something today then. :D

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • Moderators

DXRW4E,

Not real Lightweight command buttons, but a sneaky workaround: :D

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

Global $aOutline[3], $aButton[3]

$iCurrButton = 0

$hGUI = GUICreate("Test", 500, 500)

For $i = 0 To 2
    $aOutline[$i] = GUICtrlCreateLabel("", 10 + (80 * $i), 10, 80, 30, $SS_BLACKFRAME)
    GUICtrlSetState(-1, $GUI_DISABLE)
    If $i Then GUICtrlSetState(-1, $GUI_HIDE)
    $aButton[$i] = GUICtrlCreateLabel("Button " & $i + 1, 11 + (80 * $i), 11, 78, 28, BitOR($SS_CENTER, $SS_CENTERIMAGE))
Next

GUISetState()

While 1

    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            For $i = 0 To 2
                If $iMsg = $aButton[$i] Then
                    MsgBox(0, "Button", $i + 1 & " pressed")
                    ExitLoop
                EndIf
            Next
    EndSwitch

    $aCInfo = GUIGetCursorInfo()
    If Not @error Then
        For $i = 0 To 2
            If $aCInfo[4] = $aButton[$i] And $i <> $iCurrButton Then
                GUICtrlSetState($aOutline[$iCurrButton], $GUI_HIDE)
                $iCurrButton = $i
                GUICtrlSetState($aOutline[$iCurrButton], $GUI_SHOW)
                ExitLoop
            EndIf
        Next
    EndIf

WEnd

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hi Melba23, thanks for the example, for this reason or removing the icon in the example above, I can already Oten this, but as it were is not enough, we do not want to use this thing only with label, + impossible put icon in right, to imitate the Menu button ect ect in poor words BS_COMMANDLINK to some limits hmmmmm

#include <GUIConstantsEx.au3>

#include <GuiButton.au3>

#include <GuiImageList.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $hImage, $btn, $Label1, $Label2, $Label3, $aCInfo, $WB, $rdo, $chk

_Main()

Func _Main()

GUICreate("Buttons", 400, 266, 192, 124)

$Label1 = GUICtrlCreateLabel("Test 1", 48, 32, 31, 17)

$Label2 = GUICtrlCreateLabel("Test 2", 116, 32, 31, 17)

$Label3 = GUICtrlCreateLabel("Test 3", 190, 32, 31, 17)

$hImage = _GUIImageList_Create(1, 1, 5, 3, 6)

_GUIImageList_AddIcon($hImage, "shell32.dll", 111111)

;$hImage = _GUIImageList_Create(16, 16, 5, 3, 6)

;_GUIImageList_AddIcon($hImage, "shell32.dll", 1)

$btn = GUICtrlCreateButton("Button1", 48, 82, 31, 17, $BS_COMMANDLINK);"Button1 â–¼"

_GUICtrlButton_SetImageList($btn, $hImage)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

;GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

GUISetState()

While 1

Switch GUIGetMsg()

Case $btn

Switch $WB

Case $Label1

MsgBox(0, "Button", 1 & " pressed")

Case $Label2

MsgBox(0, "Button", 2 & " pressed")

Case $Label3

MsgBox(0, "Button", 3 & " pressed")

EndSwitch

Case $GUI_EVENT_CLOSE

ExitLoop

EndSwitch

$aCInfo = GUIGetCursorInfo()

If Not @error Then

If $aCInfo[4] = $Label1 Then

_GUICtrlButton_SetText($btn, GUICtrlRead($Label1))

GUICtrlSetPos($btn, 28, 18, 81, 37)

GUICtrlSetState($Label1, $GUI_HIDE)

GUICtrlSetState($btn, $GUI_SHOW + $GUI_ONTOP + $GUI_FOCUS)

$WB = $Label1

ElseIf $aCInfo[4] = $Label2 Then

_GUICtrlButton_SetText($btn, GUICtrlRead($Label2))

GUICtrlSetPos($btn, 96, 18, 81, 37)

GUICtrlSetState($Label2, $GUI_HIDE)

GUICtrlSetState($btn, $GUI_SHOW + $GUI_ONTOP + $GUI_FOCUS)

$WB = $Label2

ElseIf $aCInfo[4] = $Label3 Then

_GUICtrlButton_SetText($btn, GUICtrlRead($Label3))

GUICtrlSetPos($btn, 170, 18, 81, 37)

GUICtrlSetState($Label3, $GUI_HIDE)

GUICtrlSetState($btn, $GUI_SHOW + $GUI_ONTOP + $GUI_FOCUS)

$WB = $Label3

EndIf

EndIf

WEnd

Exit

EndFunc ;==>_Main

; using image list to set 1 image and have text on button

Func _GetImageListHandle($sFile, $nIconID = 0, $fLarge = False)

Local $iSize = 16

If $fLarge Then $iSize = 32

Local $hImage = _GUIImageList_Create($iSize, $iSize, 5, 3)

If StringUpper(StringMid($sFile, StringLen($sFile) - 2)) = "BMP" Then

_GUIImageList_AddBitmap($hImage, $sFile)

Else

_GUIImageList_AddIcon($hImage, $sFile, $nIconID, $fLarge)

EndIf

Return $hImage

EndFunc ;==>_GetImageListHandle

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)

#forceref $hWnd, $Msg, $wParam

Local Const $BCN_HOTITEMCHANGE = -1249

Local $tNMBHOTITEM = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code;dword dwFlags", $lParam)

Local $nNotifyCode = DllStructGetData($tNMBHOTITEM, "Code")

Local $nID = DllStructGetData($tNMBHOTITEM, "IDFrom")

Local $hCtrl = DllStructGetData($tNMBHOTITEM, "hWndFrom")

Local $dwFlags = DllStructGetData($tNMBHOTITEM, "dwFlags")

Local $sText = ""

Switch $nNotifyCode

Case $BCN_HOTITEMCHANGE ; Win XP and Above

If BitAND($dwFlags, 0x20) = 0x20 Then

GUICtrlSetState($btn, $GUI_HIDE)

GUICtrlSetState($WB, $GUI_SHOW)

EndIf

;~ If BitAND($dwFlags, 0x10) = 0x10 Then

;~ $sText = "$BCN_HOTITEMCHANGE - Entering: " & @CRLF

;~ ElseIf BitAND($dwFlags, 0x20) = 0x20 Then

;~ $sText = "$BCN_HOTITEMCHANGE - Leaving: " & @CRLF

;~ EndIf

;~ ConsoleWrite($sText & _

;~ "-----------------------------" & @CRLF & _

;~ "WM_NOTIFY - Infos:" & @CRLF & _

;~ "-----------------------------" & @CRLF & _

;~ "Code" & @TAB & ":" & $nNotifyCode & @CRLF & _

;~ "CtrlID" & @TAB & ":" & $nID & @CRLF & _

;~ "CtrlHWnd:" & $hCtrl & @CRLF & _

;~ _GUICtrlButton_GetText($hCtrl) & @CRLF)

EndSwitch

Return $GUI_RUNDEFMSG

EndFunc ;==>WM_NOTIFY

sorry again for my English

Ciao.

Edited by DXRW4E

apps-odrive.pngdrive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

Link to comment
Share on other sites

This looks like the lightweight command button on Win7 x64 with Aero enabled:

#include <buttonconstants.au3>
#include <guibutton.au3>
#include <windowsconstants.au3>

$hGUI = GUICreate("Test")
GUISetState()
$idButton1 = GUICtrlCreateButton(" Print...", 50, 50, 100, 50, $BS_COMMANDLINK)
_GUICtrlButton_SetImage($idButton1, "shell32.dll", 16, True)
$idButton2 = GUICtrlCreateButton("Test", 50, 150, 100, 50)


Do
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
        Case $idButton1
            Send("{TAB}")
    EndSwitch
Until False

Exit

Or without focus lines:

#include <ButtonConstants.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
OnAutoItExitRegister("_NoFocusLines_Exit")

Global $hNoFocusLines_Proc = 0, $pOrg_SliderProc = 0, $pOrg_ButtonProc = 0, $aHandle_Proc[1][2] = [[0, ""]]

$hGUI = GUICreate("Test")
GUISetState()
$idButton1 = GUICtrlCreateButton(" Print...", 50, 50, 100, 50, $BS_COMMANDLINK)
_GUICtrlButton_SetImage($idButton1, "shell32.dll", 16, True)
$hButton1 = GUICtrlGetHandle($idButton1)
$idButton2 = GUICtrlCreateButton("Test", 50, 150, 100, 50)
$hButton2 = GUICtrlGetHandle($idButton2)
_NoFocusLines_Set($idButton1)


Do
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
        Case $idButton1
            Send("{TAB}")
    EndSwitch
Until False


; #FUNCTION# =========================================================================================================
; Name...........: _NoFocusLines_Set
; Description ...: Prevents the dotted focus lines on specified button and slider class controls
; Syntax.........: _NoFocusLines_Set($vCID)
; Parameters ....: $vCID - ControlIDs of controls - multiple ControlIDs must be passed as a 0-based array
; Requirement(s).: v3.3 +
; Return values .: Success:  Returns number of controls currently subclassed
;                  Failure:  Sets @error as follows:
;                  1 = Global function already run
;                  2 = Invalid controlID
; Author ........: Melba23, based on code from Siao, aec, martin and Yashied
; Remarks .......: Any controls on which focus lines have been prevented by using the _SET function should be reset via
;                  the _CLEAR function if deleted prior to exit
; Example........: Yes
;=====================================================================================================================
Func _NoFocusLines_Set($vCID)

    Local $aCID[1]

    ; Check if Global function already used
    If $aHandle_Proc[0][1] = "Global" Then Return SetError(1, 0, 0)

    ; Check parameters are button or slider class controls
    If Not IsArray($vCID) Then
        Switch _WinAPI_GetClassName(GUICtrlGetHandle($vCID))
            Case "Button", "msctls_trackbar32"
                $aCID[0] = $vCID
            Case Else
                Return SetError(2, 0, 0)
        EndSwitch
    Else
        For $i = 0 To UBound($vCID) - 1
            Switch _WinAPI_GetClassName(GUICtrlGetHandle($vCID[$i]))
                Case "Button", "msctls_trackbar32"
                    ; ContinueLoop
                Case Else
                    Return SetError(2, 0, 0)
            EndSwitch
        Next
        $aCID = $vCID
    EndIf

    ; Check if _NoFocusLines_Proc has been registered
    If $hNoFocusLines_Proc = 0 Then
        ; Register callback function and obtain handle to _NoFocusLines_Proc
        $hNoFocusLines_Proc = DllCallbackRegister("_NoFocusLines_Proc", "int", "hwnd;uint;wparam;lparam")
    EndIf

    ; Get pointer to _NoFocusLines_Proc
    Local $pNoFocusLines_Proc = DllCallbackGetPtr($hNoFocusLines_Proc)

    ; Work through CIDs
    For $i = 0 To UBound($aCID) - 1

        ; Get handle for control
        Local $hHandle = GUICtrlGetHandle($aCID[$i])
        ; Check if control is already subclassed
        For $j = 1 To $aHandle_Proc[0][0]
            ; Skip if so
            If $hHandle = $aHandle_Proc[$j][0] Then ContinueLoop 2
        Next

        ; Increase control count
        $aHandle_Proc[0][0] += 1
        ; Double array size if too small (fewer ReDim needed)
        If UBound($aHandle_Proc) <= $aHandle_Proc[0][0] Then ReDim $aHandle_Proc[UBound($aHandle_Proc) * 2][2]

        ; Store control handle
        $aHandle_Proc[$aHandle_Proc[0][0]][0] = $hHandle
        ; Subclass control and store pointer to original WindowProc
        $aHandle_Proc[$aHandle_Proc[0][0]][1] = _NoFocusLines_SubClass($hHandle, $pNoFocusLines_Proc)

        ; If error in subclassing then remove this control from the array
        If $aHandle_Proc[$aHandle_Proc[0][0]][1] = 0 Then $aHandle_Proc[0][0] -= 1

    Next

    ; Remove any empty elements after a ReDim
    ReDim $aHandle_Proc[$aHandle_Proc[0][0] + 1][2]

    ; Check if subclassing was successful
    If $aHandle_Proc[0][0] > 0 Then
        $aHandle_Proc[0][1] = "Local"
    Else
        ; Free WndProc memory
        DllCallbackFree($hNoFocusLines_Proc)
        $hNoFocusLines_Proc = 0
    EndIf

    Return $aHandle_Proc[0][0]

EndFunc   ;==>_NoFocusLines_Set

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _NoFocusLines_SubClass
; Description ...: Sets new WindowProc for controls
; Syntax ........: _NoFocusLines_SubClass($hWnd, $pNew_WindowProc)
; Parameters ....: $hWnd - Handle of control to subclass
;                  $pNew_WindowProc - Pointer to new WindowProc
; Author ........: Melba23, based on code from Siao, aec and martin
; Modified.......:
; Remarks .......: This function is used internally by _NoFocusLines_Set and _NoFocusLines_Clear
; ===============================================================================================================================
Func _NoFocusLines_SubClass($hWnd, $pNew_WindowProc)

    Local $iRes = _WinAPI_SetWindowLong($hWnd, -4, $pNew_WindowProc)
    If @error Then Return SetError(1, 0, 0)
    If $iRes = 0 Then Return SetError(1, 0, 0)
    Return $iRes

EndFunc   ;==>_NoFocusLines_SubClass

; #FUNCTION# ====================================================================================================================
; Name...........: _NoFocusLines_Exit
; Description ...: Resets any remaining subclassed controls and frees the memory used by the UDF created WndProc
; Syntax.........: _NoFocusLines_Exit()
; Requirement(s).: v3.3 +
; Return values .: None
; Author ........: Melba23
; Remarks .......: This function should be called on exit to avoid reliance on internal AutoIt procedures for memory clean up
; Example........: Yes
;================================================================================================================================
Func _NoFocusLines_Exit()

    ; Check if _Set function used
    If $aHandle_Proc[0][1] <> "Local" Then Return SetError(1, 0, 0)

    ; First unsubclass any remaining subclassed controls
    _NoFocusLines_Clear()

    ; Now free UDF created WndProc
    DllCallbackFree($hNoFocusLines_Proc)

    Return 1

EndFunc   ;==>_NoFocusLines_Exit

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _NoFocusLines_Proc
; Description ...: Replacement WindowProc to prevent focus lines appearing on button and slider class controls
; Author ........: Melba23, based on code from Siao, aec, martin and Yashied
; Modified.......:
; Remarks .......: This function is used internally by _NoFocus_Set
; ===============================================================================================================================
Func _NoFocusLines_Proc($hWnd, $iMsg, $wParam, $lParam)

    ; Ignore SETFOCUS message from all subclassed controls
    If $iMsg = 0x0007 Then Return 0 ; $WM_SETFOCUS
    ; Locate control handle in array
    For $i = 1 To $aHandle_Proc[0][0]
        ; And pass other messages to original WindowProc
        If $hWnd = $aHandle_Proc[$i][0] Then Return _WinAPI_CallWindowProc($aHandle_Proc[$i][1], $hWnd, $iMsg, $wParam, $lParam)
    Next

EndFunc   ;==>_NoFocusLines_Proc

; #FUNCTION# =========================================================================================================
; Name...........: _NoFocusLines_Clear
; Description ...: Repermits the dotted focus lines on controls if previously prevented by _NoFocusLines_Set
; Syntax.........: _NoFocusLines_Clear($vCID)
; Parameters ....: $vCID - ControlIDs of control(s) - multiple ControlIDs must be passed as a 0-based array
;                  If no parameter passed, all previously set controls are reset
; Requirement(s).: v3.3 +
; Return values .: Success:  Returns number of controls currently subclassed
;                  Failure:  Sets @error as follows:
;                  1 = Global function already run
;                  2 = Invalid controlID
; Author ........: Melba23, based on code from Siao, aec, martin and Yashied
; Remarks .......: If controls which have had focus lines removed by the _SET function are deleted before the script
;                  exits, it is advisable to use this function on them BEFORE deletion.
; Example........: Yes
;=====================================================================================================================
Func _NoFocusLines_Clear($vCID = "")

    Local $aCID[1]

    ; Check if Global function already used
    If $aHandle_Proc[0][1] = "Global" Then Return SetError(1, 0, 0)

    If $vCID = "" Then

        ; Reset all controls to original WndProc
        For $i = 1 To $aHandle_Proc[0][0]
            _NoFocusLines_SubClass($aHandle_Proc[$i][0], $aHandle_Proc[$i][1])
        Next

        ; Reset array
        Dim $aHandle_Proc[1][2] = [[0, "Local"]]

    Else

        ; Check parameters are valid
        If Not IsArray($vCID) Then
            If Not IsHWnd(GUICtrlGetHandle($vCID)) Then Return SetError(2, 0, 0)
            $aCID[0] = $vCID
        Else
            For $i = 0 To UBound($vCID) - 1
                If Not IsHWnd(GUICtrlGetHandle($vCID[$i])) Then Return SetError(2, 0, 0)
            Next
            $aCID = $vCID
        EndIf

        ; For each specified control
        For $j = 0 To UBound($aCID) - 1
            ; Run through array to see if control has been subclassed
            For $i = 1 To $aHandle_Proc[0][0]
                ; Control found
                If $aHandle_Proc[$i][0] = GUICtrlGetHandle($aCID[$j]) Then
                    ; Unsubclass the control
                    _NoFocusLines_SubClass($aHandle_Proc[$i][0], $aHandle_Proc[$i][1])
                    ; Remove control handle and orginal WindowProc from array
                    $aHandle_Proc[$i][0] = 0
                    $aHandle_Proc[$i][1] = 0
                EndIf
            Next
        Next

        ; Remove zeroed elements of array
        For $i = $aHandle_Proc[0][0] To 1 Step -1
            If $aHandle_Proc[$i][0] = 0 Then
                ; Reduce control count
                $aHandle_Proc[0][0] -= 1
                ; Move up all following elements
                For $j = $i To $aHandle_Proc[0][0]
                    $aHandle_Proc[$j][0] = $aHandle_Proc[$j + 1][0]
                    $aHandle_Proc[$j][1] = $aHandle_Proc[$j + 1][1]
                Next
            EndIf
        Next
        ReDim $aHandle_Proc[$aHandle_Proc[0][0] + 1][2]

    EndIf

    Return $aHandle_Proc[0][0]

EndFunc   ;==>_NoFocusLines_Clear

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

From a couple of examples i tried the only thing that ruins it slightly is the focus after the button is pressed stays on the button and doesnt hide

But they are very clever

Link to comment
Share on other sites

@Chimaera

so happens even with the original lightweight command button, focus is always, if you click the button

Posted Image

@UEZ + ALL

I do not much experience with autoit, but I think the Lightweight not only to do with the button, Lightweight will have to be applied to be an foreveryone in "ComboBox" "Menu" "split button" ect ect ect (if we see it well Ribbon and only ComboBoxMenuButton with Lightweight Style), perhaps to be an Lightweight will have a style that is added, such as listivew example "DllCall('uxtheme.dll', 'uint', 'SetWindowTheme', 'hwnd', ect ect Explorer style ect ect", I do not know, and just an idea that maybe so (and if so, who and the library? to be called hmmmmmmmmm)

EDIT

it seems that the only track on the Web and this

http://msdn.microsoft.com/en-us/library/aa263493%28v=VS.60%29.aspx

http://msdn.microsoft.com/en-us/library/aa262288%28v=vs.60%29.aspx

sorry again for my English

Ciao.

Edited by DXRW4E

apps-odrive.pngdrive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

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