Jump to content

Several Rebar Issues


fett8802
 Share

Recommended Posts

Hello all,

I'm rewriting a program from scratch. The original program is actually an interesting study in my continual learning of AutoIt - it's very patchwork with new ideas as I learned them or researched them. Anyway, I'm starting over and wanting to make it super efficient, small, and fast.

However... I decided that I really liked the look of the Rebar control and now I'm trying to learn it. It's causing me several headaches. It looks great when I start the program up, but I can't figure out the best way to do resizing. First, I'll post some of the problems I'm having and then I'll post the code. Note about the GUI code: this is the code I'm working with. However, it's only testing code. I know that it is hodge-podge and poorly written. I'm merely trying to come to an understanding of the Rebar before I get into the actual program code. Here are my problems:

Problem 1:

If I minimize the GUI and restore it, the input box and two combo boxes have shifted position. If I then double click on one of the bands in the rebar (thus refreshing the control) the three control boxes shift back to their correct position.

Problem 2:

It seems that having "divider" lines in the toolbar artificially elongates the toolbar rebar control. I'd like for that extra whitespace at the end to go away. For an example of what I mean, resize the bottom right toolbar control (does not contain any dividers) and notice that the images go all the way to the left with no leftover whitespace. Now, do the same to any of the other bands and notice the leftover whitespace. Is there any way around this?

Problem 3:

Maximize the GUI. The "autosize" command of the rebar control (as best as I can figure) doesn't seem to operate like I think it should. If the control is resized, should the bands move up to make it only one or two lines? If that is not what the autosize command is for, what would be the best way to go about achieving this?

Problem 4:

I need there to be a max line size of 3. I don't want the end user expanding the rebar control down over the edit box. I could not find any way to do this. Any ideas?

Problem 5:

I would really like it if I could remove the line above the toolbar icons. I couldn't figure out how to do that last time when I was only using the toolbar controls and so I just left it. However, if there is an option to remove it that I'm unaware of, I would really like to know!

Problem 6:

When the GUI is created, the two combo boxes start out highlighted. Any way to avoid that?

Those are the main problems. I'll post anymore that I find or think of. Here is the code:

#include <GUIConstantsEx.au3>
#Include <GuiRebar.au3>
#Include <GuiToolBar.au3>
#Include <GuiMenu.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#Include <GuiStatusBar.au3>
#include <TabConstants.au3>
#Include <GuiTab.au3>
#include <EditConstants.au3>
#Include <Misc.au3>

Opt("GUIOnEventMode", 1)
Global $idSave1, $idHelp2, $idHelp3, $idHelp54, $idHelp5, $idHelp6, $idHelp7
Global $hToolBar, $iMemo, $mFile, $gRebar, $hToolBar1, $hToolBar2, $hToolBar3, $iName, $iCombo, $iCombo2
Global $iItem ; Command identifier of the button associated with the notification.
Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp
$gMain = GUICreate("Radar Coder v2",550,600,200,200, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "wClose")
$hImageList = _GUIImageList_Create(16, 16, 5, 1)
For $i = 0 To 35
_GUIImageList_AddIcon($hImageList, @ScriptDir &amp;amp;amp;amp;amp; "rcv2.dll", $i)
Next

$Options_File = GUICtrlCreateMenu("&amp;amp;amp;amp;amp;File")              ;Create new Main Menu Item
$Options_DeleteCode = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;New               Ctrl+N", $Options_File) ;Create new Sub Menu Item
$Options_LoadCode = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;Open...       Ctrl+O", $Options_File)    ;Create new Sub Menu Item
$Options_FileLine1 = GUICtrlCreateMenuItem("", $Options_File)          ;Create new Sub Menu Item
$Options_Save = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;Save               Ctrl+S", $Options_File)    ;Create new Sub Menu Item
$Options_SaveAs = GUICtrlCreateMenuItem("S&amp;amp;amp;amp;amp;ave As...      Ctrl+Alt+S", $Options_File)    ;Create new Sub Menu Item
$Options_FileLine2 = GUICtrlCreateMenuItem("", $Options_File)          ;Create new Sub Menu Item
$Options_New_Tab = GUICtrlCreateMenuItem("New &amp;amp;amp;amp;amp;Tab       Ctrl+T", $Options_File)      ;Create new Sub Menu Item
$Options_Close_Tab = GUICtrlCreateMenuItem("C&amp;amp;amp;amp;amp;lose Tab      Ctrl+W", $Options_File)  ;Create new Sub Menu Item
$Options_Rename_Tab = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;Rename Tab    Ctrl+R", $Options_File)   ;Create new Sub Menu Item
$Options_FileLine3 = GUICtrlCreateMenuItem("", $Options_File)          ;Create new Sub Menu Item
$Options_Close = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;Close             Esc", $Options_File)   ;Create new Sub Menu Item
$Options_SpellMain = GUICtrlCreateMenu("&amp;amp;amp;amp;amp;Options")            ;Create new Main Menu Item
$Options_Auto_Save = GUICtrlCreateMenuItem("A&amp;amp;amp;amp;amp;uto Save               F3", $Options_SpellMain)   ;Create new Sub Menu Item
$Options_SaveTree = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;Save Tree                F4", $Options_SpellMain)   ;Create new Sub Menu Item
$Options_FileLine3 = GUICtrlCreateMenuItem("", $Options_SpellMain)        ;Create new Sub Menu Item
$Options_OnTop = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;Always on Top        F5", $Options_SpellMain)  ;Create new Sub Menu Item
$Options_Format_Font = GUICtrlCreateMenuItem("Change &amp;amp;amp;amp;amp;Font...        F6", $Options_SpellMain)   ;Create new Sub Menu Item
$Options_Options_Reset_Defaults = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;Reset Defaults          F7", $Options_SpellMain) ;Create new Sub Menu Item
$Options_SpellCheck = GUICtrlCreateMenuItem("S&amp;amp;amp;amp;amp;pell Check...            F8", $Options_SpellMain)  ;Create new Sub Menu Item
$Options_FileLine4 = GUICtrlCreateMenuItem("", $Options_SpellMain)        ;Create new Sub Menu Item
$Options_Toolbar = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;Toolbar                    F9", $Options_SpellMain)  ;Create new Sub Menu Item
$Options_ScreenCap_Main = GUICtrlCreateMenu("&amp;amp;amp;amp;amp;Screenshot")          ;Create new Main Menu Item
$Options_ScreenCap = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;Take a Screenshot         F10",$Options_ScreenCap_Main) ;Create new Sub menu Item
$Options_HelpMain = GUICtrlCreateMenu("&amp;amp;amp;amp;amp;Help")             ;Create new Main Menu Item
$Options_Help = GUICtrlCreateMenuItem("Help        F1", $Options_HelpMain)     ;Create new Sub Menu Item
$Options_About = GUICtrlCreateMenuItem("&amp;amp;amp;amp;amp;About       F2", $Options_HelpMain)       ;Create new Sub Menu Item
_CreateRebar()
$Tab =_GUICtrlTab_Create($gMain,0,85,553,472,$TCS_BOTTOM)
GUICtrlSetResizing($Tab, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
;_GUICtrlTab_SetImageList($Tab,$hImageList2)
$Tab1 = _GUICtrlTab_InsertItem($Tab,0,"Failed")
$Tab2 = _GUICtrlTab_InsertItem($Tab,1,"Passed",16)
$Tab2 = _GUICtrlTab_InsertItem($Tab,0,"Ongoing")
$Tab2 = _GUICtrlTab_InsertItem($Tab,1,"Custom",16)
$Tab4 = _GUICtrlTab_InsertItem($Tab,0,"None")
;$Tab2 = _GUICtrlTab_InsertItem($Tab,1,"",16)
$Tab3 = _GUICtrlTab_InsertItem($Tab,0,"New")
;$Tab2 = _GUICtrlTab_InsertItem($Tab,1,"",16)
$Edit = GUICtrlCreateEdit("",0,84,551,451, BitOR($ES_MULTILINE,$ES_NOHIDESEL,$ES_WANTRETURN,$WS_VSCROLL))
  GUICtrlSetResizing($Edit, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
$StatusBar = _GUICtrlStatusBar_Create($gMain,-1,"",$SBARS_SIZEGRIP)      ;Create a new status bar control
Dim $StatusBar_PartsWidth[5] = [130, 230, 300, 420, -1]          ;Create an array for each section of the status bar
_GUICtrlStatusBar_SetParts($StatusBar, $StatusBar_PartsWidth)          ;Create the main section of the status bar
_GUICtrlStatusBar_SetText($StatusBar, "Verification Passed", 0)        ;Create the first section of the status bar
_GUICtrlStatusBar_SetText($StatusBar, "Kris Mills", 1)             ;Create the second section of the status bar
_GUICtrlStatusBar_SetText($StatusBar, @MON &amp;amp;amp;amp;amp; "/" &amp;amp;amp;amp;amp; @MDAY &amp;amp;amp;amp;amp; "/" &amp;amp;amp;amp;amp; @YEAR, 2)      ;Create the third section of the status bar
_GUICtrlStatusBar_SetText($StatusBar, "", 3)               ;Create the fourth section of the status bar
_GUICtrlStatusBar_SetText($StatusBar, "New", 4)            ;Create the fifth section of the status bar
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Tab), "wstr", 0, "wstr", 0)
GUISetState(@SW_SHOW, $gMain)
While 1
_GUICtrlRebar_SetBandBackColor($gRebar, 1, 12275690)
Sleep(1000)
_GUICtrlRebar_SetBandForeColor($gRebar, 1, 19215760)
Sleep(1000)
WEnd

Func wClose()
_GUICtrlToolbar_Destroy($hToolBar)
_GUICtrlRebar_Destroy($gRebar)
Exit
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: WM_SIZE
; Description ...: Resizes the status bar and Save Tree with the Main GUI window
; Syntax.........: WM_SIZE($hWnd, $Msg, $wParam, $lParam)
; Parameters ....: $hWnd   - The Window Handle of the GUI (Does not apply to this function, used for the Windows Message)
;      $Msg - The Windows message ID (Does not apply to this function, used for the Windows Message)
;      $wParam - The first message parameter (Does not apply to this function, used for the Windows Message)
;      $lParam - The second ,essage parameter (Does not apply to this function, used for the Windows Message)
; Return values .: Success - Returns $GUI_RUNDEFMSG
; Author ........: Kris Mills
; Related .......:
; Modified.......: 12/09/2010 - Added from main program. Cleaned up commenting, added function header.
; ===============================================================================================================================
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
$Child_Move = WinGetPos("[ACTIVE]","")              ;Get the new position of the Main GUI window
ControlMove("[ACTIVE]","",$gRebar,0,0,$Child_Move[2],$Child_Move[3])
;_CreateRebar(0)
;_CreateRebar(1)
_GUICtrlStatusBar_Resize($StatusBar)                ;Resize the Status Bar
;_GUICtrlRe
    ;Return $GUI_RUNDEFMSG                  ;Returns $GUI_RUNDEFMSG
EndFunc   ;==&amp;amp;amp;amp;gt;WM_SIZE
Func _CreateRebar($Create = 1)
If $Create = 1 Then
  $gRebar = _GUICtrlRebar_Create($gMain, BitOR($RBS_AUTOSIZE,$RBS_BANDBORDERS,$RBS_DBLCLKTOGGLE))
  $hToolBar = _GUICtrlToolBar_Create($gMain, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))
  _GUICtrlToolbar_SetImageList($hToolBar, $hImageList)
   ; Add buttons
   _GUICtrlToolbar_AddButton($hToolBar, 0, 17, 0)
   _GUICtrlToolbar_AddButton($hToolBar, 0, 19, 0)
   _GUICtrlToolbar_AddButton($hToolBar, 0, 26, 0)
   _GUICtrlToolbar_AddButton($hToolBar, 0, 2, 0)
   _GUICtrlToolbar_AddButtonSep($hToolBar)
   _GUICtrlToolbar_AddButton($hToolBar, 0, 6, 0)
   _GUICtrlToolbar_AddButton($hToolBar, 0, 5, 0)
   _GUICtrlToolbar_AddButton($hToolBar, 0, 20, 0)
   _GUICtrlToolbar_AddButton($hToolBar, 0, 7, 0)
   _GUICtrlToolbar_AddButtonSep($hToolBar)
   _GUICtrlToolbar_AddButton($hToolBar, 0, 34, 0)
   _GUICtrlToolbar_AddButton($hToolBar, 0, 23, 0)
  _GUICtrlRebar_AddToolBarBand($gRebar,$hToolBar)
  $hToolBar1 = _GUICtrlToolBar_Create($gMain, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))
  _GUICtrlToolbar_SetImageList($hToolBar1, $hImageList)
   _GUICtrlToolbar_AddButton($hToolBar1, 0, 18, 0)
   _GUICtrlToolbar_AddButton($hToolBar1, 0, 24, 0)
   _GUICtrlToolbar_AddButton($hToolBar1, 0, 3, 0)
    _GUICtrlToolbar_AddButtonSep($hToolBar1)
   _GUICtrlToolbar_AddButton($hToolBar1, 0, 27, 0)
   _GUICtrlToolbar_AddButton($hToolBar1, 0, 28, 0)
   _GUICtrlToolbar_AddButton($hToolBar1, 0, 1, 0)
   _GUICtrlToolbar_AddButton($hToolBar1, 0, 21, 0)
    _GUICtrlToolbar_AddButtonSep($hToolBar1)
   _GUICtrlToolbar_AddButton($hToolBar1, 0, 32, 0)
   _GUICtrlRebar_AddToolBarBand($gRebar,$hToolBar1)
  _GUICtrlRebar_MaximizeBand($gRebar, 1, True)
  $hToolBar2 = _GUICtrlToolBar_Create($gMain, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))
  _GUICtrlToolbar_SetImageList($hToolBar2, $hImageList)
   ; Add buttons
   _GUICtrlToolbar_AddButton($hToolBar2, 0, 0, 0)
   _GUICtrlToolbar_AddButton($hToolBar2, 0, 13, 0)
   _GUICtrlToolbar_AddButton($hToolBar2, 0, 33, 0)
   _GUICtrlToolbar_AddButton($hToolBar2, 0, 29, 0)
   _GUICtrlToolbar_AddButtonSep($hToolBar2)
   _GUICtrlToolbar_AddButton($hToolBar2, 0, 31, 0)
   _GUICtrlToolbar_AddButton($hToolBar2, 0, 30, 0)
   _GUICtrlToolbar_AddButton($hToolBar2, 0, 16, 0)
   _GUICtrlToolbar_AddButton($hToolBar2, 0, 22, 0)
   _GUICtrlToolbar_AddButtonSep($hToolBar2)
   _GUICtrlToolbar_AddButton($hToolBar2, 0, 9, 0)
   _GUICtrlToolbar_AddButton($hToolBar2, 0, 8, 0)
  _GUICtrlRebar_AddToolBarBand($gRebar,$hToolBar2,"",-1)
  ;_GUICtrlRebar_SetBandStyleBreak($gRebar, 1, True)
  $hToolBar3 = _GUICtrlToolBar_Create($gMain, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))
  _GUICtrlToolbar_SetImageList($hToolBar3, $hImageList)
   _GUICtrlToolbar_AddButton($hToolBar3, 0, 10, 0)
   _GUICtrlToolbar_AddButton($hToolBar3, 0, 15, 0)
   _GUICtrlToolbar_AddButton($hToolBar3, 0, 11, 0)
   _GUICtrlToolbar_AddButton($hToolBar3, 0, 4, 0)
   _GUICtrlToolbar_AddButton($hToolBar3, 0, 25, 0)
   _GUICtrlToolbar_AddButton($hToolBar3, 0, 14, 0)
   _GUICtrlToolbar_AddButton($hToolBar3, 0, 12, 0)
  _GUICtrlRebar_AddToolBarBand($gRebar,$hToolBar3)
  _GUICtrlRebar_MaximizeBand($gRebar, 3, True)
  $iName = GUICtrlCreateInput("Kris Mills",0,0,25,17)
  _GUICtrlRebar_AddBand($gRebar, $iName, 90, 150, "Name: ", -1,$RBBS_BREAK)
  $iCombo = GUICtrlCreateCombo("Passed",0,0,30,10)
  GUICtrlSetData($iCombo,"Failed|Ongoing|Custom|None")
  _GUICtrlRebar_AddBand($gRebar, $iCombo, 84, 100, "State:", -1)
  $iCombo2 = GUICtrlCreateCombo("h1. Biggest Heading",0,0,30,17)
  GUICtrlSetData($iCombo2,"h2. Bigger Heading|h3. Big Heading|h4. Normal Heading|h5. Small Heading|h6. Smallest Heading")
  _GUICtrlRebar_AddBand($gRebar, $iCombo2, 101, 125, "Heading:", -1)
Else
  GUICtrlDelete($iCombo)
  GUICtrlDelete($iName)
  GUICtrlDelete($iCombo2)
  For $i = 0 To 6
   _GUICtrlRebar_DeleteBand($gRebar,$i)
  Next
  _GUICtrlRebar_Destroy($gRebar)
EndIf
EndFunc

And you'll need the dll containing the images. That can be found in the post below.

Just drop that file into the same directory as the code from above.

Thank you all very much for looking at this with me. I wouldn't have posted unless I had exhausted every thread with the word rebar in it; which I did, haha.

- Fett

Edited by fett8802
[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]
Link to comment
Share on other sites

Sorry for the double post, but the full editor was not working correctly when I tried to edit the attachment in the above post. Here is the updated custom dll file for this program.

Thanks,

Fett

rcv2.dll

[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]
Link to comment
Share on other sites

  • 2 weeks later...

I hate to bump topics, but it's been over a week and I let the topic slide off the front page. I really need some help. Plus, this thread could serve as a good example for those with Rebar problems in the future.

Any ideas?

Thanks,

Fett

Edited by fett8802
[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...