eltorro Posted January 26, 2006 Share Posted January 26, 2006 (edited) Another quick and dirty proof of concept.This script splits the window horizontally and vertically.Please check it out.expandcollapse popup#include <GUIConstants.au3> #include <GuiStatusbar.au3> ;=============================================================================== ; FileName: splitterdemo.au3 ; Description: Splitter Bar demo ; ; Requirement: Beta ; Author(s): eltorro (Steve Podhajecki <[email="gehossafats@netmdc.com"]gehossafats@netmdc.com[/email]>) ; Note(s): This is just a proof of concept at the moment. ; This could be tweaked into a udf with a little more work ; The basic principle is to create a pic box and drag it ; then resize the controls. ; I bowwored some filler for the tree and list from the help files. ;=============================================================================== $WM_SIZE =0x0005 $Form1 = GUICreate("Splitter Demo", 622, 448, 192, 125, BitOr($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU,$WS_CLIPCHILDREN)) $TreeView1 = GUICtrlCreateTreeView(0, 8, 145, 313, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, 42) $generalitem = GUICtrlCreateTreeViewItem("General", $TreeView1) GUICtrlSetColor(-1, 0x0000C0) $displayitem = GUICtrlCreateTreeViewItem("Display", $TreeView1) GUICtrlSetColor(-1, 0x0000C0) $aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem) $compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem) $useritem = GUICtrlCreateTreeViewItem("User", $generalitem) $resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem) $otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem) $ListView1 = GUICtrlCreateListView("col1 |col2|col3 ", 152, 8, 465, 313, -1, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, 44) $item1 = GUICtrlCreateListViewItem("item2|col22|col23", $ListView1) $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $ListView1) $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $ListView1) GUICtrlSetState(-1, $GUI_DROPACCEPTED); to allow drag and dropping GUISetState() GUICtrlSetData($item2, "ITEM1") GUICtrlSetData($item3, "||COL33") ;vertical divider $Pic1 = GUICtrlCreatePic("", 144, 8, 5, 313, $SS_NOTIFY) GUICtrlSetResizing($Pic1, 128 +2+256) GUICtrlSetCursor($Pic1, 13) ;horizontal divider. $Pic2 = GUICtrlCreatePic("", 0, 320, 617, 20, BitOR($SS_NOTIFY, $SS_ETCHEDFRAME), $WS_EX_CLIENTEDGE) GUICtrlSetResizing($Pic2, 8 + 64 + 512) GUICtrlSetCursor($Pic2, 11) Local $a[3] = [150,150, -1] Local $b[3] = ["Ready.", "",""], $InitiateDrag = "False", $DragCtrl $Status1 = _GuiCtrlStatusBarCreate ($Form1, $a, $b) $Edit1 = GUICtrlCreateEdit("", 0, 328, 617, 113, -1, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, 128) GUICtrlSetData($Edit1, "Drag the bars between the controls and they will resize." & @CRLF & _ "Resize the screen and see what happens."& @CRLF & _ "The Status bar show True the left mouse button is down and over a splitter.") opt("MouseCoordMode", 2) GUICtrlSetState($generalitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) ; Expand the "General"-item and paint in bold GUICtrlSetState($displayitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) ; Expand the "Display"-item and paint in bold GUISetState(@SW_SHOW) ResizeControls() GUIRegisterMsg($WM_SIZE,"RESIZECONTROLS") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_PRIMARYDOWN _GuiCtrlStatusBarSetText ($Status1, "Primary Down", 0) Case $msg = $Pic1 _GuiCtrlStatusBarSetText ($Status1, "Pic1 Primary Down",0) $InitiateDrag = "True" $DragCtrl = $Pic1 Case $msg = $Pic2 _GuiCtrlStatusBarSetText ($Status1, "Pic2 Primary Down", 0) $InitiateDrag = "True" $DragCtrl = $Pic2 Case $msg = $GUI_EVENT_PRIMARYUP _GuiCtrlStatusBarSetText ($Status1, "Primary Up", 0) $InitiateDrag = "False" Select Case $DragCtrl = $Pic1 SplitterVert($TreeView1, $ListView1, $Pic1, $Pic2) $DragCtrl = "" Case $DragCtrl = $Pic2 SplitterHort($TreeView1, $ListView1, $Edit1, $Pic2) $DragCtrl = "" EndSelect Case $msg = $GUI_EVENT_SECONDARYDOWN _GuiCtrlStatusBarSetText ($Status1, "Secondary Down", 0) Case $msg = $GUI_EVENT_SECONDARYUP _GuiCtrlStatusBarSetText ($Status1, "Secondary Up", 0) Case $msg = $GUI_EVENT_MOUSEMOVE _GuiCtrlStatusBarSetText ($Status1, "Mouse Move", 0) If $InitiateDrag = "True" Then _GuiCtrlStatusBarSetText ($Status1, "Dragging", 1) Local $picpos = ControlGetPos("", "", $DragCtrl) Local $mousepos = MouseGetPos() Local $winpos = WinGetClientSize("") If $DragCtrl = $Pic1 Then If $mousepos[0] > 25 And $mousepos[0]< ($winpos[0] - 25) Then GUICtrlSetPos($Pic1, $mousepos[0], $picpos[1]) EndIf If $DragCtrl = $Pic2 Then If $mousepos[1] > 25 And $mousepos[1]< ($winpos[1] - 25) Then GUICtrlSetPos($Pic2, $picpos[0], $mousepos[1]) EndIf EndIf Case $msg = $GUI_EVENT_RESIZED or $msg = $GUI_EVENT_MAXIMIZE ResizeControls() Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else If _GuiCtrlStatusBarGetText ($Status1, 0) <> "Ready." Then _GuiCtrlStatusBarSetText ($Status1, "Ready.", 0) If _GuiCtrlStatusBarGetText ($Status1, 1) <> $InitiateDrag Then _GuiCtrlStatusBarSetText ($Status1, $InitiateDrag, 1) ;;;;;;; EndSelect WEnd Exit Func RESIZE_CONTROLS($hWnd, $Msg, $wParam, $lParam) ResizeControls() Return $GUI_RUNDEFMSG EndFunc Func ResizeControls() ; GUISetState(@SW_LOCK) ;_ResizeHandler();needed to handle child???? _GuiCtrlStatusBarResize ($Status1) Local $winpos = WinGetPos("") Local $picpos1 = ControlGetPos("", "", $Pic1) Local $picpos2 = ControlGetPos("", "", $Pic2) Local $pos = $picpos2 GUICtrlSetPos($Pic2, 0, $picpos2[1], $winpos[2], $picpos2[3]) GUICtrlSetPos($Pic1, $picpos1[0], $picpos1[1], $picpos1[2], $picpos2[1]) SplitterHort($TreeView1, $ListView1, $Edit1, $Pic2) SplitterVert($TreeView1, $ListView1, $Pic1, $Pic2) ; GUISetState(@SW_UNLOCK) EndFunc;==>ResizeControls Func SplitterVert($ctrl1, $ctrl2, $split1, $split2) Local $splitpos1 = ControlGetPos("", "", $split1) Local $splitpos2 = ControlGetPos("", "", $split2) Local $ctrl1pos = ControlGetPos("", "", $ctrl1) Local $ctrl2pos = ControlGetPos("", "", $ctrl2) Local $winpos = WinGetClientSize("") GUICtrlSetPos($ctrl1, $ctrl1pos[0], _ $ctrl1pos[1], _ (($splitpos1[0] - 1) - $ctrl1pos[0]), _ $splitpos2[1]-10) Local $nw = $winpos[0] - $splitpos1[0] - 5 GUICtrlSetPos($ctrl2, $splitpos1[0] + 5, _ $ctrl2pos[1], _ $nw, _ $splitpos2[1] - 10) EndFunc;==>SplitterVert Func SplitterHort($ctrl1, $ctrl2, $ctrl3, $split) Local $splitpos = ControlGetPos("", "", $split) Local $ctrl1pos = ControlGetPos("", "", $ctrl1) Local $ctrl2pos = ControlGetPos("", "", $ctrl2) Local $ctrl3pos = ControlGetPos("", "", $ctrl3) Local $winpos = WinGetClientSize("") Local $nh Select Case $splitpos[1] > $ctrl1pos[3] $nh = ($ctrl1pos[3]+ ($splitpos[1] - $ctrl1pos[3])) - 10 Case $splitpos[1] < $ctrl1pos[3] $nh = ($ctrl1pos[3]- ($ctrl1pos[3] - $splitpos[1])) - 10 EndSelect GUICtrlSetPos($ctrl1, $ctrl1pos[0], _ $ctrl1pos[1], _ $ctrl1pos[2], _ $nh) GUICtrlSetPos($ctrl2, $ctrl2pos[0], _ $ctrl2pos[1], _ $ctrl2pos[2], _ $nh) Local $nh $nh = $winpos[1] - $splitpos[1] + $splitpos[3] - 60; move this up above the status bar ; ConsoleWrite($nh & "=" & $winpos[1] & "-" & $splitpos[1] & "+" & $splitpos[3] & "-40" & @CR) GUICtrlSetPos($ctrl3, $ctrl3pos[0], _ $splitpos[1] + $splitpos[3] + 1, _ $winpos[0], _ $nh) EndFunc;==>SplitterHortsplitterdemo.au3Edit: I updated the code a little bit. Now has form buttons, and everything resizes if the window resizes.splitterdemo.au3Edit: Fixed a couple of bugs.splitterdemo.au3Hope someone finds this useful.edit: Finally changed you to your in the topic title. Edited July 13, 2007 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted January 26, 2006 Moderators Share Posted January 26, 2006 I like it! Glancing at your script it looks like the seperaters are pictures. Am I correct? Link to comment Share on other sites More sharing options...
eltorro Posted January 26, 2006 Author Share Posted January 26, 2006 Yes the seperator bars are picture boxes. $SS_NOTIFY style is needed for the mouse events to register. I'm going to assume that a label would probable work too. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
Gene Posted January 30, 2006 Share Posted January 30, 2006 (edited) This is VERY cool, I like it a lot! I see many uses for it, I'm sure there are many more I haven't thought of yet. Gene Edit: spelling Another quick and dirty proof of concept. This script splits the window horizontally and vertically. Please check it out. expandcollapse popup#include <GUIConstants.au3> #include <GuiStatusbar.au3> ;=============================================================================== ; FileName: splitterdemo.au3 ; Description: Splitter Bar demo ; ; Requirement: Beta .103 or > ; Author(s): eltorro (Steve Podhajecki <gehossafats@netmdc.com>) ; Note(s): This is just a proof of concept at the moment. ; This could be tweaked into a udf with a little more work ; The basic principle is to create a pic box and drag it ; then resize the controls. ; I borrowed some filler for the tree and list from the help files. ;=============================================================================== $Form1 = GUICreate("Splitter Bar", 622, 448, 192, 125, $WS_SIZEBOX) $TreeView1 = GUICtrlCreateTreeView(0, 8, 145, 313, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, 42) $generalitem = GUICtrlCreateTreeViewItem("General", $TreeView1) GUICtrlSetColor(-1, 0x0000C0) $displayitem = GUICtrlCreateTreeViewItem("Display", $TreeView1) GUICtrlSetColor(-1, 0x0000C0) $aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem) $compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem) $useritem = GUICtrlCreateTreeViewItem("User", $generalitem) $resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem) $otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem) $ListView1 = GUICtrlCreateListView("col1 |col2|col3 ", 152, 8, 465, 313, -1, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, 44) $item1 = GUICtrlCreateListViewItem("item2|col22|col23", $ListView1) $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $ListView1) $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $ListView1) GUICtrlSetState(-1, $GUI_DROPACCEPTED); to allow drag and dropping GUISetState() GUICtrlSetData($item2, "ITEM1") GUICtrlSetData($item3, "||COL33") $Pic1 = GUICtrlCreatePic("", 144, 8, 5, 313, $SS_NOTIFY) GUICtrlSetResizing($Pic1, 128 + 256);2+32+256) GUICtrlSetCursor($Pic1, 13) $Pic2 = GUICtrlCreatePic("", 0, 320, 617, 20, BitOR($SS_NOTIFY, $SS_ETCHEDFRAME), $WS_EX_CLIENTEDGE) GUICtrlSetResizing($Pic2, 2 + 8 + 512) GUICtrlSetCursor($Pic2, 11) Local $a[2] = [150, -1] Local $b[2] = ["Ready.", ""], $InitiateDrag = "False", $DragCtrl $Status1 = _GuiCtrlStatusBarCreate ($Form1, $a, $b) $Edit1 = GUICtrlCreateEdit("", 0, 328, 617, 113, -1, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, 128) GUICtrlSetData($Edit1, "Drag the bars between the controls and they will resize." & @CRLF & _ "Resize the screen and see what happens."& @CRLF & _ "The Status bar show True the left mouse button is down and over a splitter.") opt("MouseCoordMode", 2) GUICtrlSetState($generalitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)); Expand the "General"-item and paint in bold GUICtrlSetState($displayitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)); Expand the "Display"-item and paint in bold GUISetState(@SW_SHOW) ResizeControls() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_PRIMARYDOWN _GuiCtrlStatusBarSetText ($Status1, "Primary Down", 0) Case $msg = $Pic1 _GuiCtrlStatusBarSetText ($Status1, "Pic Primary Down", 0) $InitiateDrag = "True" $DragCtrl = $Pic1 Case $msg = $Pic2 _GuiCtrlStatusBarSetText ($Status1, "Pic Primary Down", 0) $InitiateDrag = "True" $DragCtrl = $Pic2 Case $msg = $GUI_EVENT_PRIMARYUP _GuiCtrlStatusBarSetText ($Status1, "Primary Up", 0) $InitiateDrag = "False" Select Case $DragCtrl = $Pic1 SplitterVert($TreeView1, $ListView1, $Pic1, $Pic2) $DragCtrl = "" Case $DragCtrl = $Pic2 SplitterHort($TreeView1, $ListView1, $Edit1, $Pic2) $DragCtrl = "" EndSelect Case $msg = $GUI_EVENT_SECONDARYDOWN _GuiCtrlStatusBarSetText ($Status1, "Secondary Down", 0) Case $msg = $GUI_EVENT_SECONDARYUP _GuiCtrlStatusBarSetText ($Status1, "Secondary Up", 0) Case $msg = $GUI_EVENT_MOUSEMOVE _GuiCtrlStatusBarSetText ($Status1, "Mouse Move", 0) If $InitiateDrag = "True" Then _GuiCtrlStatusBarSetText ($Status1, "Dragging", 1) Local $picpos = ControlGetPos("", "", $DragCtrl) Local $mousepos = MouseGetPos() Local $winpos = WinGetClientSize("") If $DragCtrl = $Pic1 Then If $mousepos[0] > 25 And $mousepos[0]< ($winpos[0] - 25) Then GUICtrlSetPos($Pic1, $mousepos[0], $picpos[1]) EndIf If $DragCtrl = $Pic2 Then If $mousepos[1] > 25 And $mousepos[1]< ($winpos[1] - 25) Then GUICtrlSetPos($Pic2, $picpos[0], $mousepos[1]) EndIf EndIf Case $msg = $GUI_EVENT_RESIZED ResizeControls() Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else If _GuiCtrlStatusBarGetText ($Status1, 0) <> "Ready." Then _GuiCtrlStatusBarSetText ($Status1, "Ready.", 0) If _GuiCtrlStatusBarGetText ($Status1, 1) <> $InitiateDrag Then _GuiCtrlStatusBarSetText ($Status1, $InitiateDrag, 1) ;;;;;;; EndSelect WEnd Exit Func ResizeControls() ;_ResizeHandler();needed to handle child???? _GuiCtrlStatusBarResize ($Status1) Local $winpos = WinGetPos("") Local $picpos1 = ControlGetPos("", "", $Pic1) Local $picpos2 = ControlGetPos("", "", $Pic2) Local $pos = $picpos2 GUICtrlSetPos($Pic2, 0, $picpos2[1], $winpos[2], $picpos2[3]) GUICtrlSetPos($Pic1, $picpos1[0], $picpos1[1], $picpos1[2], $picpos2[1] - 1) SplitterHort($TreeView1, $ListView1, $Edit1, $Pic2) SplitterVert($TreeView1, $ListView1, $Pic1, $Pic2) EndFunc;==>ResizeControls Func SplitterVert($ctrl1, $ctrl2, $split1, $split2) Local $splitpos1 = ControlGetPos("", "", $split1) Local $splitpos2 = ControlGetPos("", "", $split2) Local $ctrl1pos = ControlGetPos("", "", $ctrl1) Local $ctrl2pos = ControlGetPos("", "", $ctrl2) Local $winpos = WinGetClientSize("") GUICtrlSetPos($ctrl1, $ctrl1pos[0], _ $ctrl1pos[1], _ (($splitpos1[0] - 1) - $ctrl1pos[0]), _ $splitpos2[1] - 10) Local $nw = $winpos[0] - $splitpos1[0] - 5 GUICtrlSetPos($ctrl2, $splitpos1[0] + 5, _ $ctrl2pos[1], _ $nw, _ $splitpos2[1] - 10) EndFunc;==>SplitterVert Func SplitterHort($ctrl1, $ctrl2, $ctrl3, $split) Local $splitpos = ControlGetPos("", "", $split) Local $ctrl1pos = ControlGetPos("", "", $ctrl1) Local $ctrl2pos = ControlGetPos("", "", $ctrl2) Local $ctrl3pos = ControlGetPos("", "", $ctrl3) Local $winpos = WinGetClientSize("") Local $nh Select Case $splitpos[1] > $ctrl1pos[3] $nh = ($ctrl1pos[3]+ ($splitpos[1] - $ctrl1pos[3])) - 10 Case $splitpos[1] < $ctrl1pos[3] $nh = ($ctrl1pos[3]- ($ctrl1pos[3] - $splitpos[1])) - 10 EndSelect GUICtrlSetPos($ctrl1, $ctrl1pos[0], _ $ctrl1pos[1], _ $ctrl1pos[2], _ $nh) GUICtrlSetPos($ctrl2, $ctrl2pos[0], _ $ctrl2pos[1], _ $ctrl2pos[2], _ $nh) Local $nh $nh = $winpos[1] - $splitpos[1] + $splitpos[3] - 60; move this up above the status bar ; ConsoleWrite($nh & "=" & $winpos[1] & "-" & $splitpos[1] & "+" & $splitpos[3] & "-40" & @CR) GUICtrlSetPos($ctrl3, $ctrl3pos[0], _ $splitpos[1] + $splitpos[3] + 1, _ $winpos[0], _ $nh) EndFunc;==>SplitterHort splitterdemo.au3 Hope someone finds this useful. Edited January 30, 2006 by Gene [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right... Link to comment Share on other sites More sharing options...
eltorro Posted February 9, 2006 Author Share Posted February 9, 2006 Updated first post. Steve Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
rakudave Posted February 9, 2006 Share Posted February 9, 2006 nice! keep it up! Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
PerryRaptor Posted February 10, 2006 Share Posted February 10, 2006 Good Work! Link to comment Share on other sites More sharing options...
MikelSevrel Posted March 9, 2006 Share Posted March 9, 2006 I like, you mind if I use part(with credit, of course)? Coming soon.... Link to comment Share on other sites More sharing options...
Valuater Posted March 9, 2006 Share Posted March 9, 2006 Nice Work!! 8) Link to comment Share on other sites More sharing options...
Gigglestick Posted March 9, 2006 Share Posted March 9, 2006 (edited) Very nice! I was trying to figure out an effective way to do multi-paned windows, but got bored with the project and abandoned it. I'm glad you didn't. One thing though. As I drag the window to size it, things shift oddly. See the attachments. Basically, the left pane gets smaller, the right pane follows it, and the bottom pane moves downward. Attachment 1: Start the script. Attachments 2 & 3: After dragging the lower-right corner around a bit. Edited March 9, 2006 by c0deWorm My UDFs: ExitCodes Link to comment Share on other sites More sharing options...
eltorro Posted March 14, 2006 Author Share Posted March 14, 2006 Very nice! I was trying to figure out an effective way to do multi-paned windows, but got bored with the project and abandoned it. I'm glad you didn't. One thing though. As I drag the window to size it, things shift oddly. See the attachments. Basically, the left pane gets smaller, the right pane follows it, and the bottom pane moves downward.There was an issue with GuiCtrlSetResizing for the pic bars.They now remain stationary when dragging the window to resize.I also fixed an issue when maximizing the window the vertical bar was not re-drawn.Updated code is in first post. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
eltorro Posted March 14, 2006 Author Share Posted March 14, 2006 Updated code again. Added window style $WS_CLIPCHILDREN. Reduces the annoying flicker when resizing the window. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
DjDeep00 Posted June 30, 2006 Share Posted June 30, 2006 How can you have two horizontal splits? Link to comment Share on other sites More sharing options...
Daniel W. Posted June 30, 2006 Share Posted June 30, 2006 Wow nice , well done --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
WTS Posted July 1, 2006 Share Posted July 1, 2006 Nice! i'm glad somebody finaly implemented this to autoit! Link to comment Share on other sites More sharing options...
RazerM Posted July 2, 2006 Share Posted July 2, 2006 Nice! Could come in handy some time. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
WTS Posted July 5, 2006 Share Posted July 5, 2006 I set the style to this.. $ListView1 = GUICtrlCreateListView("col1 |col2|col3 ", 152, 8, 465, 313,BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)) and the whole listview disapeared.. Link to comment Share on other sites More sharing options...
eltorro Posted July 7, 2006 Author Share Posted July 7, 2006 I set the style to this.. $ListView1 = GUICtrlCreateListView("col1 |col2|col3 ", 152, 8, 465, 313,BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)) and the whole listview disapeared.. Try $ListView1 = GUICtrlCreateListView("col1 |col2|col3 ", 152, 8, 465, 313,BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE) eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
tresa Posted October 21, 2006 Share Posted October 21, 2006 (edited) Updated code again. Added window style $WS_CLIPCHILDREN. Reduces the annoying flicker when resizing the window. I modified the code to take rid of several bugs. All the lines I modified have ;!!! so that you can find them You can run it without the beta version of AutoIt expandcollapse popup#include <GUIConstants.au3> #include <GuiStatusbar.au3> ;=============================================================================== ; FileName: splitterdemo.au3 ; Description: Splitter Bar demo ; ; Requirement: Beta ;!!! Beta not necessary ; Author(s): eltorro (Steve Podhajecki <gehossafats@netmdc.com>) ; Note(s): This is just a proof of concept at the moment. ; This could be tweaked into a udf with a little more work ; The basic principle is to create a pic box and drag it ; then resize the controls. ; I bowwored some filler for the tree and list from the help files. ;=============================================================================== ;$WM_SIZE =0x0005 $Form1 = GUICreate("Splitter Demo", 622, 448, 192, 125, BitOr($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU,$WS_CLIPCHILDREN)) $TreeView1 = GUICtrlCreateTreeView(0, 8, 145, 313, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1,1+2+32);jcd 42) $generalitem = GUICtrlCreateTreeViewItem("General", $TreeView1) GUICtrlSetColor(-1, 0x0000C0) $displayitem = GUICtrlCreateTreeViewItem("Display", $TreeView1) GUICtrlSetColor(-1, 0x0000C0) $aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem) $compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem) $useritem = GUICtrlCreateTreeViewItem("User", $generalitem) $resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem) $otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem) $ListView1 = GUICtrlCreateListView("col1 |col2|col3 ", 152, 8, 465, 313, -1, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1,4+32);!!! 44) $item1 = GUICtrlCreateListViewItem("item2|col22|col23", $ListView1) $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $ListView1) $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $ListView1) GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping GUISetState() GUICtrlSetData($item2, "ITEM1") GUICtrlSetData($item3, "||COL33") ;vertical divider $Pic1 = GUICtrlCreatePic("", 144, 8, 5, 313, $SS_NOTIFY) GUICtrlSetResizing($Pic1, 32+64+256);!!! 128 +2+256) GUICtrlSetCursor($Pic1, 13) GUICtrlSetBkColor($Pic1,$GUI_BKCOLOR_TRANSPARENT ) ;horizontal divider. $Pic2 = GUICtrlCreatePic("", 0, 320, 617, 20,$SS_NOTIFY);!!! BitOR($SS_NOTIFY, $SS_ETCHEDFRAME), $WS_EX_CLIENTEDGE) GUICtrlSetResizing($Pic2, 2+4+512);!!!8 + 64 + 512) GUICtrlSetBkColor($Pic2,$GUI_BKCOLOR_TRANSPARENT ) GUICtrlSetCursor($Pic2, 11) Local $a[3] = [150,350, -1];!!! Local $b[3] = ["Ready.", "",""], $InitiateDrag = "False", $DragCtrl $Status1 = _GuiCtrlStatusBarCreate ($Form1, $a, $B) $Edit1 = GUICtrlCreateEdit("", 0, 328, 617, 113, -1, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1,2+4+64);!!! 128) GUICtrlSetData($Edit1, "Drag the bars between the controls and they will resize." & @CRLF & _ "Resize the screen and see what happens."& @CRLF & _ "The Status bar show True the left mouse button is down and over a splitter.") opt("MouseCoordMode", 2) GUICtrlSetState($generalitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) ; Expand the "General"-item and paint in bold GUICtrlSetState($displayitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) ; Expand the "Display"-item and paint in bold GUISetState(@SW_SHOW) dim $precedingMsg,$stopTime ResizeControls() ;!!!GUIRegisterMsg($WM_SIZE,"RESIZE_CONTROLS") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_PRIMARYDOWN _GuiCtrlStatusBarSetText ($Status1, "Primary Down", 0) Case $msg = $Pic1 if $DragCtrl="" then _GuiCtrlStatusBarSetText ($Status1, "Pic1 Primary Down",0) $InitiateDrag = "True" $DragCtrl = $Pic1 Case $msg = $Pic2 _GuiCtrlStatusBarSetText ($Status1, "Pic2 Primary Down", 0) $InitiateDrag = "True" $DragCtrl = $Pic2 Case $msg = $GUI_EVENT_PRIMARYUP _GuiCtrlStatusBarSetText ($Status1, "Primary Up", 0) $InitiateDrag = "False" _GuiCtrlStatusBarSetText ($Status1, "", 1) Select Case $DragCtrl = $Pic1 SplitterVert($TreeView1, $ListView1, $Pic1, $Pic2) $DragCtrl = "" Case $DragCtrl = $Pic2 SplitterHort($TreeView1, $ListView1, $Edit1, $Pic2) $DragCtrl = "" EndSelect Case $msg = $GUI_EVENT_SECONDARYDOWN _GuiCtrlStatusBarSetText ($Status1, "Secondary Down", 0) Case $msg = $GUI_EVENT_SECONDARYUP _GuiCtrlStatusBarSetText ($Status1, "Secondary Up", 0) Case $msg = $GUI_EVENT_MOUSEMOVE $stopTime=TimerInit() If $InitiateDrag = "True" Then _GuiCtrlStatusBarSetText ($Status1, "Dragging", 1) Local $picpos = ControlGetPos("", "", $DragCtrl) Local $mousepos = MouseGetPos() Local $winpos = WinGetClientSize("") If $DragCtrl = $Pic1 Then If $mousepos[0] > 25 And $mousepos[0]< ($winpos[0] - 25) Then GUICtrlSetPos($Pic1, $mousepos[0], $picpos[1]) EndIf If $DragCtrl = $Pic2 Then If $mousepos[1] > 25 And $mousepos[1]< ($winpos[1] - 25) Then GUICtrlSetPos($Pic2, $picpos[0], $mousepos[1]) EndIf Else _GuiCtrlStatusBarSetText ($Status1, "Mouse Move", 0) EndIf Case $msg = $GUI_EVENT_RESIZED or $msg = $GUI_EVENT_MAXIMIZE or $msg=$GUI_EVENT_RESTORE;!!! ResizeControls() Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else;!!! $idleTime=TimerDiff($stopTime) if $idleTime>100 Then $stopTime=TimerInit() if $InitiateDrag = "True" Then _GuiCtrlStatusBarSetText ($Status1, "Idling", 1) Else _GuiCtrlStatusBarSetText ($Status1, "Idling", 0) EndIf EndIf EndSelect WEnd Exit ;!!!Func RESIZE_CONTROLS($hWnd, $Msg, $wParam, $lParam) ;!!! ResizeControls() ;!!! Return $GUI_RUNDEFMSG ;!!!EndFunc Func ResizeControls() ; GUISetState(@SW_LOCK) ;_ResizeHandler();needed to handle child???? _GuiCtrlStatusBarResize ($Status1) ;!!! Local $winpos = WinGetPos("") ;!!! Local $picpos1 = ControlGetPos("", "", $Pic1) ;!!! Local $picpos2 = ControlGetPos("", "", $Pic2) ;!!! Local $pos = $picpos2 ;!!! GUICtrlSetPos($Pic1, $picpos1[0], $picpos1[1], $picpos1[2], $picpos2[1]) ;!!! GUICtrlSetPos($Pic2, 0, $picpos2[1], $winpos[2], $picpos2[3]) SplitterHort($TreeView1, $ListView1, $Edit1, $Pic2) SplitterVert($TreeView1, $ListView1, $Pic1, $Pic2) ; GUISetState(@SW_UNLOCK) EndFunc ;==>ResizeControls Func SplitterVert($ctrl1, $ctrl2, $split1, $split2) GUICtrlSetState($split1,$gui_hide);!!! Local $splitpos1 = ControlGetPos("", "", $split1) Local $splitpos2 = ControlGetPos("", "", $split2) Local $ctrl1pos = ControlGetPos("", "", $ctrl1) Local $ctrl2pos = ControlGetPos("", "", $ctrl2) Local $winpos = WinGetClientSize("") GUICtrlSetPos($ctrl1, $ctrl1pos[0], _ $ctrl1pos[1], _ (($splitpos1[0] - 1) - $ctrl1pos[0]), _ $splitpos2[1]-10) Local $nw = $winpos[0] - $splitpos1[0] - 5 GUICtrlSetPos($ctrl2, $splitpos1[0] + 5, _ $ctrl2pos[1], _ $nw, _ $splitpos2[1] - 10) GUICtrlSetPos($split1,$splitpos1[0],$splitpos1[1],$splitpos1[2],$ctrl2pos[3]);!!! GUICtrlSetState($split1,$gui_show);!!! EndFunc ;==>SplitterVert Func SplitterHort($ctrl1, $ctrl2, $ctrl3, $split) GUICtrlSetState($split,$gui_hide);!!! Local $splitpos = ControlGetPos("", "", $split) Local $ctrl1pos = ControlGetPos("", "", $ctrl1) Local $ctrl2pos = ControlGetPos("", "", $ctrl2) Local $ctrl3pos = ControlGetPos("", "", $ctrl3) Local $winpos = WinGetClientSize("") Local $nh Select Case $splitpos[1] > $ctrl1pos[3] $nh = ($ctrl1pos[3]+ ($splitpos[1] - $ctrl1pos[3])) - 10 Case $splitpos[1] < $ctrl1pos[3] $nh = ($ctrl1pos[3]- ($ctrl1pos[3] - $splitpos[1])) - 10 EndSelect GUICtrlSetPos($ctrl1, $ctrl1pos[0], _ $ctrl1pos[1], _ $ctrl1pos[2], _ $nh) GUICtrlSetPos($ctrl2, $ctrl2pos[0], _ $ctrl2pos[1], _ $ctrl2pos[2], _ $nh) Local $splitpic1 = ControlGetPos("", "", $pic1);!!! GUICtrlSetPos($pic1,$splitpic1[0],$splitpic1[1],$splitpic1[2],$nh);!!! Local $nh $nh = $winpos[1] - $splitpos[1] + $splitpos[3] - 60; move this up above the status bar ; ConsoleWrite($nh & "=" & $winpos[1] & "-" & $splitpos[1] & "+" & $splitpos[3] & "-40" & @CR) GUICtrlSetPos($ctrl3, $ctrl3pos[0], _ $splitpos[1] + $splitpos[3] + 1, _ $winpos[0], _ $nh) GUICtrlSetState($split,$gui_show);!!! EndFunc ;==>SplitterHort Edited October 21, 2006 by tresa Link to comment Share on other sites More sharing options...
Uten Posted October 21, 2006 Share Posted October 21, 2006 Nice touch @tresa. Althought it still does not redraw the splitters correctly all the time. Increas the bottom area then decrease it. I thought this would do it, but no Case $DragCtrl = $Pic1 SplitterVert($TreeView1, $ListView1, $Pic1, $Pic2) $DragCtrl = "" If 0 = DLLCall("user32.dll","int","InvalidateRect","hwnd",Hwnd($Pic1),"int",0,"int",1) Then ;invalidate client area ConsoleWrite("!FAILDE to invalidaterect $Pic1" & @LF) EndIf Case $DragCtrl = $Pic2 SplitterHort($TreeView1, $ListView1, $Edit1, $Pic2) $DragCtrl = "" If 0 = DLLCall("user32.dll","int","InvalidateRect","hwnd",Hwnd($Pic2),"int",0,"int",1) Then ;invalidate client area ConsoleWrite("!FAILDE to invalidaterect $Pic2" & @LF) EndIf Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling 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