jim1 Posted March 29, 2009 Share Posted March 29, 2009 hello i have made a script and i wanted to have buttons that extend gui, but i want the gui to start with only showing listbox, 3 labels(steps) and 3 buttons but if i decrease numbers instead of shrinking left side they eat right side. so how i can make gui start with only listbox, 3 labels(steps) and 3 buttons and step 2 button makes gui like it opens now?? also about checkboxes someone helped me and saw me a way that says true or false if pressed , i changed it to write at txt a small dialog and if it is true or false to be easier to see what checkbox is checked,is there any way to change it to only write checkbox name? expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Opt('GUIResizeMode', 802) $Form1 = GUICreate("Diaulos v1.1", 471, 217, -1, -1, -1, $WS_EX_ACCEPTFILES) $Button1 = GUICtrlCreateButton("(Not allowed)", 168, 88, 33, 33, $BS_BITMAP) GUICtrlSetImage(-1, ".\images\arrow_right.bmp", 0) $Button2 = GUICtrlCreateButton("(Not allowed)", 304, 180, 33, 33, $BS_BITMAP) GUICtrlSetImage(-1, ".\images\arrow_down.bmp", 0) $Button3 = GUICtrlCreateButton("(Not allowed)", 432, 88, 33, 33, $BS_BITMAP) GUICtrlSetImage(-1, ".\images\arrow_left.bmp", 0) $Label1 = GUICtrlCreateLabel("Step 1 Drop files", 280, 8, 82, 17) $Label2 = GUICtrlCreateLabel("Step 2", 172, 64, 35, 17) $Label3 = GUICtrlCreateLabel("Step 3", 264, 188, 35, 17) $Label4 = GUICtrlCreateLabel("Step 4", 428, 64, 35, 17) $But1 = GUICtrlCreateButton("Chemistry", 392, 264, 65, 25, 0) $But2 = GUICtrlCreateButton("Physic", 392, 296, 65, 25, 0) $But3 = GUICtrlCreateButton("Biology", 392, 328, 65, 25, 0) $Label5 = GUICtrlCreateLabel("Enter your name here first", 200, 236, 124, 17) $Label6 = GUICtrlCreateLabel("Choose lesson", 388, 236, 73, 17) $name = GUICtrlCreateInput("", 172, 264, 169, 21) $But8 = GUICtrlCreateButton("Create folder", 200, 296, 117, 29, 0) $But4 = GUICtrlCreateButton("Rar folder", 488, 32, 73, 25, 0) $But9 = GUICtrlCreateButton("Preview", 488, 64, 73, 25, 0) $But5 = GUICtrlCreateButton("Send files", 488, 96, 73, 25, 0) $cListBox = GUICtrlCreateList("", 225, 47, 190, 125) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $Group1 = GUICtrlCreateGroup("Class", 4, 20, 49, 81) $Checkbox1 = GUICtrlCreateCheckbox("A", 12, 36, 41, 17) $Checkbox2 = GUICtrlCreateCheckbox("B", 12, 56, 45, 17) $Checkbox3 = GUICtrlCreateCheckbox("C", 12, 76, 49, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Specialization", 64, 20, 93, 81) $Checkbox4 = GUICtrlCreateCheckbox("Informatics", 68, 36, 85, 17) $Checkbox5 = GUICtrlCreateCheckbox("Medicine", 68, 56, 85, 17) $Checkbox6 = GUICtrlCreateCheckbox("Engineering", 68, 76, 81, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label7 = GUICtrlCreateLabel("Comments", 52, 108, 53, 17) $input1 = GUICtrlCreateInput("write comments here", 4, 132, 153, 21) $Input2 = GUICtrlCreateInput("Write Name", 8, 224, 149, 21) $Input3 = GUICtrlCreateInput("Job", 8, 252, 149, 21) $Label8 = GUICtrlCreateLabel("Your info", 56, 196, 46, 17) $Button11 = GUICtrlCreateButton("Send data", 44, 292, 69, 21, 0) GUISetState(@SW_SHOW) Func _IsChecked($control) Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc While 1 $Msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE DirRemove(@ScriptDir & "\teacher1files\" & GUICtrlRead($Name), 1) Exit Case $GUI_EVENT_DROPPED GUICtrlSetData($cListBox, @GUI_DRAGFILE & @CRLF, 1) case $button11 $Info1 = GUICtrlRead($input2) $Info2 = GUICtrlRead($input3) $Info3 = GUICtrlRead($Input1) $Checked1 = _IsChecked($Checkbox1) $Checked2 = _IsChecked($Checkbox2) $Checked3 = _IsChecked($Checkbox3) $Checked4 = _IsChecked($Checkbox4) $Checked5 = _IsChecked($Checkbox5) $Checked6 = _IsChecked($Checkbox6) FileWrite(@ScriptDir & "\teacher1files\Text.txt", $Info1 & @CRLF) FileWrite(@ScriptDir & "\teacher1files\Text.txt", $Info2 & @CRLF) FileWrite(@ScriptDir & "\teacher1files\Text.txt", $Info3 & @CRLF) FileWrite(@ScriptDir & "\teacher1files\Text.txt", "class A is " & $Checked1 & @CRLF) FileWrite(@ScriptDir & "\teacher1files\Text.txt", "class B is " & $Checked2 & @CRLF) FileWrite(@ScriptDir & "\teacher1files\Text.txt", "class C is " & $Checked3 & @CRLF) FileWrite(@ScriptDir & "\teacher1files\Text.txt", "specialization informatics is " & $Checked4 & @CRLF) FileWrite(@ScriptDir & "\teacher1files\Text.txt", "specialization Medicine is " & $Checked5 & @CRLF) FileWrite(@ScriptDir & "\teacher1files\Text.txt", "specialization Engineering is " & $Checked6 & @CRLF) case $But4 Dim $sWinRAR = @ScriptDir & '\winrar\' Run($sWinRAR & 'winrar a ".\t1files" ".\teacher1files"') case $But5 SoundPlay("Sounds/Connecting.mp3") case $But3 SoundPlay("Sounds/bio.mp3") DirCreate(@SCRIPTDIR &"\teacher1files\"& GUICtrlRead($Name) &"\Biology") Filecopy(@GUI_DRAGFILE , @scriptdir & "\teacher1files\" & GUICtrlRead($Name) & "\" & guictrlread($But3) & "\") case $But1 SoundPlay("") DirCreate(@SCRIPTDIR &"\teacher1files\"& GUICtrlRead($Name) &"\Chemistry") Filecopy(@GUI_DRAGFILE , @scriptdir & "\teacher1files\" & GUICtrlRead($Name) & "\" & guictrlread($But1) & "\") case $But2 SoundPlay("Sounds/Physic.mp3") DirCreate(@SCRIPTDIR &"\teacher1files\"& GUICtrlRead($Name) &"\Physic") Filecopy(@GUI_DRAGFILE , @scriptdir & "\teacher1files\" & GUICtrlRead($Name) & "\" & guictrlread($But2) & "\") case $but8 DirCreate(@SCRIPTDIR &"\teacher1files\"& GUICtrlRead($Name)) case $but9 ShellExecute("t1files.rar") case $button2 winmove("","",default,default,477, 392) case $button3 winmove("","",default,default,595, 249) EndSwitch WEnd Link to comment Share on other sites More sharing options...
Authenticity Posted March 29, 2009 Share Posted March 29, 2009 Dim $fRightOpen = False, $fDownOpen = False . . . case $button2 $fDownOpen = Not $fDownOpen _Shrink($fRightOpen, $fDownOpen) case $button3 $fRightOpen = Not $fRightOpen _Shrink($fRightOpen, $fDownOpen) . . . Func _Shrink($fRight, $fDown) If $fDown Then If $fRight Then WinMove("", "", Default, Default, 595, 392) Else WinMove("", "", Default, Default, 477, 392) EndIf Else If $fRight Then WinMove("", "", Default, Default, 595, 249) Else WinMove("", "", Default, Default, 477, 249) EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 29, 2009 Moderators Share Posted March 29, 2009 jim1, Perhaps you might think of using child windows that open rather than resizing the whole GUI. This is pretty rough (because I am not going to recalculate every coordinate!) but should give you an idea of what I mean:expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> Opt('GUIResizeMode', 802) $Form1 = GUICreate("Diaulos v1.1", 471, 217, -1, -1, -1, $WS_EX_ACCEPTFILES) $Button1 = GUICtrlCreateButton("(Not allowed)", 168, 88, 33, 33, $BS_BITMAP) GUICtrlSetImage(-1, ".\images\arrow_right.bmp", 0) $Button2 = GUICtrlCreateButton("(Not allowed)", 304, 180, 33, 33, $BS_BITMAP) GUICtrlSetImage(-1, ".\images\arrow_down.bmp", 0) $Button3 = GUICtrlCreateButton("(Not allowed)", 432, 88, 33, 33, $BS_BITMAP) GUICtrlSetImage(-1, ".\images\arrow_left.bmp", 0) $Label1 = GUICtrlCreateLabel("Step 1 Drop files", 280, 8, 82, 17) $Label2 = GUICtrlCreateLabel("Step 2", 172, 64, 35, 17) $Label3 = GUICtrlCreateLabel("Step 3", 264, 188, 35, 17) $Label4 = GUICtrlCreateLabel("Step 4", 428, 64, 35, 17) $cListBox = GUICtrlCreateList("", 225, 47, 190, 125) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) $Form2 = GUICreate("Step 2", 165, 217, -1, -1, $WS_POPUP, $WS_EX_MDICHILD, $Form1) GUICtrlCreateGraphic(0, 0, 165, 217, $SS_BLACKFRAME) $Group1 = GUICtrlCreateGroup("Class", 4, 20, 49, 81) $Checkbox1 = GUICtrlCreateCheckbox("A", 12, 36, 41, 17) $Checkbox2 = GUICtrlCreateCheckbox("B", 12, 56, 45, 17) $Checkbox3 = GUICtrlCreateCheckbox("C", 12, 76, 49, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Specialization", 64, 20, 93, 81) $Checkbox4 = GUICtrlCreateCheckbox("Informatics", 68, 36, 85, 17) $Checkbox5 = GUICtrlCreateCheckbox("Medicine", 68, 56, 85, 17) $Checkbox6 = GUICtrlCreateCheckbox("Engineering", 68, 76, 81, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label7 = GUICtrlCreateLabel("Comments", 52, 108, 53, 17) $input1 = GUICtrlCreateInput("write comments here", 4, 132, 153, 21) Local $aWin_Pos = WinGetPos($Form1) WinMove($Form2, "", $aWin_Pos[0] - 165, $aWin_Pos[1]) GUISetState(@SW_HIDE, $Form2) $Form3 = GUICreate("Step 3", 500, 200, -1, -1, $WS_POPUP, $WS_EX_MDICHILD, $Form1) GUICtrlCreateGraphic(0, 0, 500, 200, $SS_BLACKFRAME) $But1 = GUICtrlCreateButton("Chemistry", 392, 64, 65, 25, 0) $But2 = GUICtrlCreateButton("Physic", 392, 96, 65, 25, 0) $But3 = GUICtrlCreateButton("Biology", 392, 128, 65, 25, 0) $Label5 = GUICtrlCreateLabel("Enter your name here first", 200, 36, 124, 17) $Label6 = GUICtrlCreateLabel("Choose lesson", 388, 36, 73, 17) $name = GUICtrlCreateInput("", 172, 64, 169, 21) $But8 = GUICtrlCreateButton("Create folder", 200, 96, 117, 29, 0) $Input2 = GUICtrlCreateInput("Write Name", 8, 24, 149, 21) $Input3 = GUICtrlCreateInput("Job", 8, 52, 149, 21) $Label8 = GUICtrlCreateLabel("Your info", 56, 0, 46, 17) $Button11 = GUICtrlCreateButton("Send data", 44, 92, 69, 21, 0) Local $aWin_Pos = WinGetPos($Form1) WinMove($Form3, "", $aWin_Pos[0], $aWin_Pos[1] + 240) GUISetState(@SW_HIDE, $Form3) $Form4 = GUICreate("Step 4", 165, 217, -1, -1, $WS_POPUP, $WS_EX_MDICHILD, $Form1) GUICtrlCreateGraphic(0, 0, 165, 217, $SS_BLACKFRAME) $But4 = GUICtrlCreateButton("Rar folder", 10, 32, 73, 25, 0) $But9 = GUICtrlCreateButton("Preview", 10, 64, 73, 25, 0) $But5 = GUICtrlCreateButton("Send files", 10, 96, 73, 25, 0) Local $aWin_Pos = WinGetPos($Form1) WinMove($Form4, "", $aWin_Pos[0] + 480, $aWin_Pos[1]) GUISetState(@SW_HIDE, $Form4) Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ;DirRemove(@ScriptDir & "\teacher1files\" & GUICtrlRead($name), 1) Exit Case $Button1 GUISetState(@SW_SHOW, $Form2) Case $Button2 GUISetState(@SW_SHOW, $Form3) Case $Button3 GUISetState(@SW_SHOW, $Form4) EndSwitch WEnd 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 Link to comment Share on other sites More sharing options...
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