Jump to content

Search the Community

Showing results for tags 'grill'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Often I need to create a panel to monitor a lot of things (users, files, items etc) so I use this piece of code to create a dynamic grid of buttons. The number of buttons is variable, and it's related to the size of the gui, the size of the buttons and the distance between buttons. Every "button" is a set of three with a real button stacked on the top of two labels, imagine reading a .CSV file or an array or a database and displaying all the things using the labels (Text and COLOR too) and clickin' on the relative button you can call further info on the item or call a particular function. So you can decide the number of the buttons, the width of the buttons, and also the distance between buttons. It's quick and dirty, simple and very improvable (I know..) so fell free to play with the code. ;TEST ;GOL-Grill ;Grill test/template ; (c) 2019 NSC ; V.0.6 #Region ;************ Includes ************ #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <ProgressConstants.au3> #include <_GOLLOG.au3>; NSC first UDF #EndRegion ;************ Includes ************ Dim $agButton[1] Global $ButtonU, $rProgress, $form1, $labeltot, $ntotButtonS ; the number of buttons is variable based on the guisize, the button size and button distance, three examples.... ;Global $guiwidth = 850, $guiheight = 500, $buttonW = 150, $buttonHDistance = 10, $buttonVDistance = 20 ; SMALL GUI / BIG BUTTONS <- try it ! Global $guiwidth = 1500, $guiheight = 700, $buttonW = 90 , $buttonHDistance = 29, $buttonVDistance = 3; BIG GUI / SMALL BUTTONS ;Global $guiwidth = 1200, $guiheight = 800, $buttonW = 300, $buttonHDistance = 30, $buttonVDistance = 7; last two variables are horizontal and vertical distance between buttons Global $ver = "V.0.6" Gollog(">>>>> START") Dim $aResult[11] = [10, "a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] ; this is an example, it can be an array, a DB, a .text file read in real time. Gui() Gollog("start analyzing...") Monitor() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE CLOSEClicked() Exit Case $ButtonU Monitor() Case Else For $i = 1 To $ntotButtonS If $nMsg = $agButton[$i] Then $Bhit = GUICtrlRead($agButton[$i]) infoB($Bhit) EndIf Next EndSwitch WEnd Func Gui() $form1 = GUICreate("Buttons on a grill " & $ver & " (c) NSC 2019", $guiwidth, $guiheight, 90, 10) $ButtonU = GUICtrlCreateButton("Update", 2, 2, 170, 50) $labeltot = GUICtrlCreateLabel("Total found", 5, 55) $Gollogedit = GUICtrlCreateEdit("", 2, $guiheight - 255, 180, 250, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_BORDER)) $rProgress = GUICtrlCreateProgress($guiwidth - 18, 5, 16, $guiheight - 7, BitOR($PBS_SMOOTH, $PBS_VERTICAL, $WS_BORDER)) GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x000000) GUISetState(@SW_SHOW) EndFunc ;==>Gui Func Monitor() GUIDelete($form1) Gui() $leftSTART = 186 ;left align $topSTART = 5 ;start from top $lineDOWN = 45 + $buttonVDistance ; vertical line distance 45 is buttons very near $extraHSTEP = 3 ; extra line distance $buttonSEMIH = 15 ; height of one of the 3 vertical impiled semibuttons $separatorSEMIH = 2 ;vertical distance between 3 semibuttons $separatorW = 2 ;aux horizontal distance ;---------- derived measures $rightLIMIT = $guiwidth - 123 ; right limit befor Carriage Return $leftINCREMENT = $buttonHDistance + $buttonW ; horizontal increment button after button $leftSTEP = $leftSTART ;incremental horizontal $topSTEP = $topSTART ;incremental vertical $foundB = $aResult[0] GUICtrlSetData($labeltot, "Found n°" & $foundB) $ntotButtonS = 0 $nomorebuttons = 0 For $i = 1 To $foundB Local $itemFound = $aResult[$i] ;\TA1000 Gollog($itemFound) GUICtrlCreateGroup('', $leftSTEP, $topSTEP - 3, $buttonW + 3, 50) ;______first-----------------------------_______line___________________UNO________11111_____\\\\\\\\\\------------ Local $textbutton = "button n°" & $i _ArrayAdd($agButton, GUICtrlCreateButton($textbutton, $leftSTEP + $separatorSEMIH, $topSTEP + $extraHSTEP, $buttonW, $buttonSEMIH, $BS_flat)) GUICtrlSetBkColor(-1, 0xccffcc) ;green, sort of GUICtrlSetFont(-1, 7, -1, -1, 'verdana') GUICtrlSetColor(-1, 0x000000) ;___second__________line___________________DUE ________222222-------------------------------------------------------------------- Local $textLINE2 = $itemFound GUICtrlCreateLabel($textLINE2, $leftSTEP + $separatorW, $topSTEP + $buttonSEMIH + $separatorSEMIH, $buttonW, $buttonSEMIH, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xD2D7A8) GUICtrlSetFont(-1, 7, -1, -1, 'verdana') GUICtrlSetColor(-1, 0x000000) ; __third______line________tre___________________________________________________________333333-3333333-333333333-333333-33333-33333-3333-------------------------------- Local $textLINE3 = "line3" GUICtrlCreateLabel($textLINE3, $leftSTEP + $separatorW, $topSTEP + $buttonSEMIH + $buttonSEMIH + $separatorSEMIH, $buttonW, $buttonSEMIH, BitOR($SS_CENTER, $SS_CENTERIMAGE)) ; NSC modify GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 7, -1, -1, 'verdana') GUICtrlSetColor(-1, 0x000000) $ntotButtonS += 1 GUICtrlSetData($rProgress, (100 * $ntotButtonS / $foundB)) If $leftSTEP + $buttonW < $rightLIMIT Then ; $leftSTEP += $leftINCREMENT ;53 Else $leftSTEP = $leftSTART $topSTEP += $lineDOWN If $topSTEP >= $guiheight - 50 Then $nomorebuttons = 1 Gollog("displayed " & $ntotButtonS & " buttons") Gollog("NO more buttons !") EndIf EndIf Sleep(100) ; REMOVE is only for demo Next While $nomorebuttons = 0 ; draw empty buttons (nice to do) $ntotButtonS += 1 _ArrayAdd($agButton, GUICtrlCreateButton("B-" & $ntotButtonS, $leftSTEP + $separatorSEMIH, $topSTEP + $extraHSTEP, $buttonW, $buttonSEMIH, $BS_flat)) If $leftSTEP + $buttonW < $rightLIMIT Then ; $leftSTEP += $leftINCREMENT Else $leftSTEP = $leftSTART $topSTEP += $lineDOWN If $topSTEP >= $guiheight - 50 Then $nomorebuttons = 1 Gollog("displayed " & $ntotButtonS & " buttons") Gollog("NO more buttons !") EndIf EndIf WEnd GUISetState(@SW_SHOW) EndFunc ;==>Monitor Func infoB($Bhit) ; this function act on the pressed button, it's an example so assign the task you need. gollog("infoB -> " & $Bhit) EndFunc ;==>infoB Func CLOSEClicked() MsgBox(64, "exit", "program exiting", 1) Gollog("<---STOP") Exit EndFunc ;==>CLOSEClicked You will need also the Include from this post for the LOG (Gollog) instructions, but you can also just remove the gollog and the EDIT box. Look at the screenshot, It's from an APP made using this code. 21/11/2019 V.0.6 Script lightly updated with better management of buttons size and distance.
×
×
  • Create New...