Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Split your GUI


  • Please log in to reply
24 replies to this topic

#1 eltorro

eltorro

    more or less the same as the latter of the former.

  • Active Members
  • PipPipPipPipPipPip
  • 596 posts

Posted 26 January 2006 - 08:45 PM

Another quick and dirty proof of concept.

This script splits the window horizontally and vertically.

Please check it out.
Plain Text         
#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;==>SplitterHort

Attached File  splitterdemo.au3   7.1KB   878 downloads
Edit
: I updated the code a little bit. Now has form buttons, and everything resizes if the window resizes.
Attached File  splitterdemo.au3   7.34KB   417 downloads
Edit: Fixed a couple of bugs.
Attached File  splitterdemo.au3   7.47KB   538 downloads

Hope someone finds this useful.

edit: Finally changed you to your in the topic title.

Edited by eltorro, 13 July 2007 - 02:44 PM.








#2 big_daddy

big_daddy

  • Moderators
  • 2,591 posts

Posted 26 January 2006 - 09:01 PM

I like it! Glancing at your script it looks like the seperaters are pictures. Am I correct?

#3 eltorro

eltorro

    more or less the same as the latter of the former.

  • Active Members
  • PipPipPipPipPipPip
  • 596 posts

Posted 26 January 2006 - 09:09 PM

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.

#4 Gene

Gene

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 494 posts

Posted 30 January 2006 - 12:01 AM

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.

Plain Text         
#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


Attached File  splitterdemo.au3   7.1KB   878 downloads
Hope someone finds this useful.


Edited by Gene, 30 January 2006 - 12:02 AM.

Thanks for the response.GeneYes, I know the punctuation is not right...

#5 eltorro

eltorro

    more or less the same as the latter of the former.

  • Active Members
  • PipPipPipPipPipPip
  • 596 posts

Posted 09 February 2006 - 07:30 AM

Updated first post.

Steve

#6 rakudave

rakudave

    Polymath

  • Active Members
  • PipPipPipPip
  • 245 posts

Posted 09 February 2006 - 10:30 PM

nice! keep it up!

#7 PerryRaptor

PerryRaptor

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 383 posts

Posted 10 February 2006 - 12:44 AM

Good Work!

#8 MikelSevrel

MikelSevrel

    Wayfarer

  • Active Members
  • Pip
  • 57 posts

Posted 09 March 2006 - 10:27 PM

I like, you mind if I use part(with credit, of course)?
Coming soon....

#9 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,200 posts

Posted 09 March 2006 - 10:32 PM

Nice Work!!

8)

Posted Image

Clic The Pic!!!


#10 Gigglestick

Gigglestick

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 502 posts

Posted 09 March 2006 - 10:41 PM

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

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 by c0deWorm, 09 March 2006 - 10:42 PM.

My UDFs: ExitCodes

#11 eltorro

eltorro

    more or less the same as the latter of the former.

  • Active Members
  • PipPipPipPipPipPip
  • 596 posts

Posted 14 March 2006 - 06:32 PM

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.

#12 eltorro

eltorro

    more or less the same as the latter of the former.

  • Active Members
  • PipPipPipPipPipPip
  • 596 posts

Posted 14 March 2006 - 07:14 PM

Updated code again.

Added window style $WS_CLIPCHILDREN.

Reduces the annoying flicker when resizing the window.

#13 DjDeep00

DjDeep00

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 654 posts

Posted 30 June 2006 - 05:19 PM

How can you have two horizontal splits?

#14 Daniel W.

Daniel W.

    I hacked 127.0.0.1 !!!

  • Active Members
  • PipPipPipPipPipPip
  • 434 posts

Posted 30 June 2006 - 05:20 PM

Wow nice , well done :D
--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------

Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.


#15 WTS

WTS

    Polymath

  • Active Members
  • PipPipPipPip
  • 247 posts

Posted 01 July 2006 - 01:38 AM

Nice! i'm glad somebody finaly implemented this to autoit!

#16 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 02 July 2006 - 06:14 PM

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.

#17 WTS

WTS

    Polymath

  • Active Members
  • PipPipPipPip
  • 247 posts

Posted 05 July 2006 - 12:49 AM

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

#18 eltorro

eltorro

    more or less the same as the latter of the former.

  • Active Members
  • PipPipPipPipPipPip
  • 596 posts

Posted 07 July 2006 - 07:47 PM

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

#19 tresa

tresa

    Wayfarer

  • Active Members
  • Pip
  • 96 posts

Posted 21 October 2006 - 08:19 AM

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
AutoIt         
#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 by tresa, 21 October 2006 - 02:41 PM.


#20 Uten

Uten

    stupid is as stupid does..

  • Active Members
  • PipPipPipPipPipPip
  • 1,989 posts

Posted 21 October 2006 - 03:54 PM

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 :lmao:
 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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users