ReconX Posted May 10, 2014 Posted May 10, 2014 (edited) I want a title and a description on the button. I want the Title to obviously be bigger than the description. Is there a way to do that? Below is my attempt at it. xD expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <array.au3> ; An array to hold the label ControlIDs Global $aLabel[6] ; A variable to show the last label which changed colour Global $iLastLabel = 0 Global $aText[6] = ["Malwarebytes Removal Tool", "Second label", "Third label", "Fourth label", "Fifth label", "Sixth label"] Global $aSecondary[6] = ["Bump", "Grump", " ", " ", " ", " "] $hGUI = GUICreate("Test", 500, 600) For $i = 0 To 5 $aLabel[$i] = GUICtrlCreateLabel($aText[$i] & @CRLF & $aSecondary[$i], 0, 0 + (50 * $i), 450, 45, BitOr($SS_CenterImage, $SS_Center)) GUICtrlSetBkColor($aLabel[$i], $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($aText[1], 13, 800) GUICtrlSetFont($aSecondary[1], 9.5, 800) Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; Get cursor info $aCInfo = GUIGetCursorInfo($hGUI) ; loop through the label array to see which one is under the cursor For $i = 0 To 5 ; If we are over a new label If $aCInfo[4] = $aLabel[$i] And $iLastLabel <> $i Then ; Recolour previos label GUICtrlSetBkColor($aLabel[$iLastLabel], $GUI_BKCOLOR_TRANSPARENT) ; colour current label GUICtrlSetBkColor($aLabel[$i], 0xFF0000) ; Store this label $iLastLabel = $i ; No point in looking further ExitLoop EndIf Next WEnd Also, the $SS_CenterImage doesn't allow both the strings to be centered to the button, is there a way to do that also without it becoming one line? Edited May 10, 2014 by ReconX
Moderators Melba23 Posted May 10, 2014 Moderators Posted May 10, 2014 ReconX,Not too difficult - use 2 labels: expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> ; An array to hold the label ControlIDs Global $aLabel[6] ; A variable to show the last label which changed colour Global $iLastLabel = 0 Global $aText[6] = ["Malwarebytes Removal Tool", "Second label", "Third label", "Fourth label", "Fifth label", "Sixth label"] Global $aSecondary[6] = ["Bump", "Grump", " ", " ", " ", " "] $hGUI = GUICreate("Test", 500, 600) For $i = 0 To 5 ; Create the main title label $aLabel[$i] = GUICtrlCreateLabel($aText[$i], 0, 0 + (50 * $i), 450, 45, $SS_Center) GUICtrlSetBkColor($aLabel[$i], $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($aLabel[$i], 13, 800) ; Now create a secondary label to hold the subtitle $cSec = GUICtrlCreateLabel($aSecondary[$i], 0, 20 + (50 * $i), 450, 45, $SS_Center) GUICtrlSetBkColor($cSec, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($cSec, 9.5, 800) Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $aLabel[0] ConsoleWrite("Hit" & @CRLF) EndSwitch ; Get cursor info $aCInfo = GUIGetCursorInfo($hGUI) ; loop through the label array to see which one is under the cursor For $i = 0 To 5 ; If we are over a new label If $aCInfo[4] = $aLabel[$i] And $iLastLabel <> $i Then ; Recolour previos label GUICtrlSetBkColor($aLabel[$iLastLabel], $GUI_BKCOLOR_TRANSPARENT) ; colour current label GUICtrlSetBkColor($aLabel[$i], 0xFF0000) ; Store this label $iLastLabel = $i ; No point in looking further ExitLoop EndIf Next WEndAll clear? M23 mesale0077 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
UEZ Posted May 10, 2014 Posted May 10, 2014 @M23 was faster. expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <array.au3> ; An array to hold the label ControlIDs Global $aLabel1[6], $aLabel2[6] ; A variable to show the last label which changed colour Global $iLastLabel = 0 Global $aText[6] = ["Malwarebytes Removal Tool", "Second label", "Third label", "Fourth label", "Fifth label", "Sixth label"] Global $aSecondary[6] = ["Bump", "Grump", "", "", "", ""] $hGUI = GUICreate("Test", 500, 600) For $i = 0 To 5 $aLabel1[$i] = GUICtrlCreateLabel($aText[$i], 0, (50 * $i), 500, 45, BitOr($SS_CenterImage, $SS_Center)) GUICtrlSetBkColor($aLabel1[$i], $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($aLabel1[$i], 14, 800, 0, "Arial", 4) $aLabel2[$i] = GUICtrlCreateLabel($aSecondary[$i], (StringLen($aText[$i]) + StringLen($aSecondary[$i])) * 5.25, (50 * $i), 500, 45, BitOr($SS_CenterImage, $SS_Center)) GUICtrlSetFont($aLabel2[$i], 7, 400, 0, "Arial", 5) GUICtrlSetBkColor($aLabel2[$i], $GUI_BKCOLOR_TRANSPARENT) Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; Get cursor info $aCInfo = GUIGetCursorInfo($hGUI) ; loop through the label array to see which one is under the cursor For $i = 0 To 5 ; If we are over a new label If ($aCInfo[4] = $aLabel1[$i] Or $aCInfo[4] = $aLabel2[$i]) And $iLastLabel <> $i Then ; Recolour previos label GUICtrlSetBkColor($aLabel1[$iLastLabel], $GUI_BKCOLOR_TRANSPARENT) ; colour current label GUICtrlSetBkColor($aLabel1[$i], 0xFF0000) ; Store this label $iLastLabel = $i ; No point in looking further ExitLoop EndIf Next WEnd Br, UEZ mesale0077 1 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now