The MASM Forum
General => The Workshop => Topic started by: zedd151 on December 18, 2022, 09:53:42 AM
-
Has anyone done any work with toolbars/rebar control other than for 'bitmap buttons'?
I am planning on having a toolbar that has the text boxes for search and replace with accompanying buttons and checkboxes. Either that or I'll roll my own ... :biggrin:
-
Z,
That sounds like a separate window, located at the top of the client area and you fill it with whatever controls you like. You don't need to use a toolbar or rebar to do that and it would be a reasonably simple task to do. I have done them in the past just by putting buttons at the top of the client area, drop down combo boxes will go in the same place with no problems.
-
Kinda what I thought I would do too, hutch. Just thought that maybe there were another, possibly better way.
-
(https://i.postimg.cc/x80J7gTK/winbif-rebar.png)
I created the text search and filter controls via dialog. I initialize the toolbar, adding buttons to it, then I initialize the text and combo controls and add content to the dropdown combo and save handles for later. I subclass the text control to handle searching.
InitToolBarTxtSearch PROC hWin:DWORD Invoke GetDlgItem, hWin, IDC_TxtSearch
mov hTxtSearch, eax
Invoke GetDlgItem, hWin, IDC_BtnSearch
mov hBtnSearch, eax
invoke SetWindowLong, hTxtSearch, GWL_WNDPROC, Addr TxtSearchProc
mov OldTxtSearchProc,eax
Invoke SendMessage, hTxtSearch, EM_SETLIMITTEXT, 14, 0
ret
InitToolBarTxtSearch endp
InitCboBifFilter PROC hWin:DWORD
Invoke GetDlgItem, hWin, IDC_CboBifFilter
mov hCboBifFilter, eax
Invoke SendMessage, hCboBifFilter, CB_RESETCONTENT, 0, 0
Invoke SendMessage, hCboBifFilter, CB_ADDSTRING, 0, Addr szFilterShowAll
Invoke SendMessage, hCboBifFilter, CB_ADDSTRING, 0, Addr szFilterAllFiles
Invoke SendMessage, hCboBifFilter, CB_ADDSTRING, 0, Addr szFilterAllTiles
Invoke SendMessage, hCboBifFilter, CB_ADDSTRING, 0, Addr szFilterWMP
Invoke SendMessage, hCboBifFilter, CB_ADDSTRING, 0, Addr szFilterVVC
Invoke SendMessage, hCboBifFilter, CB_SETCURSEL, 0, 0
ret
InitCboBifFilter endp
Then I add those to the rebar control, using the toolbar, text, and combobox control handles that where saved previously.
InitRebar PROC hWin:DWORD
LOCAL RebarInfo:REBARINFO
LOCAL rbbi:REBARBANDINFO
LOCAL tbhandl:DWORD
LOCAL tbTile:DWORD
Invoke GetDlgItem, hWin, IDC_RbBIF
mov hRebarBif, eax
; Toolbar band
mov rbbi.cbSize,SIZEOF REBARBANDINFO
mov rbbi.fMask, RBBIM_ID or RBBIM_STYLE or RBBIM_CHILDSIZE or RBBIM_CHILD or RBBIM_SIZE
mov rbbi.wID, IDC_MAINTOOLBAR
mov rbbi.fStyle, RBBS_CHILDEDGE or RBBS_TOPALIGN or RBBS_FIXEDSIZE;RBBS_CHILDEDGE or RBBS_FIXEDSIZE RBBS_FIXEDSIZE
mov rbbi.lx,0
mov rbbi.cxIdeal, 160
mov rbbi.cxMinChild,160
mov rbbi.cyMinChild,24
mov rbbi.cyChild,24
mov eax, hToolBar
mov rbbi.hwndChild, eax
invoke SendMessage,hRebarBif,RB_INSERTBAND,0,ADDR rbbi
; Search Text band
mov rbbi.fMask, RBBIM_ID or RBBIM_STYLE or RBBIM_CHILDSIZE or RBBIM_CHILD or RBBIM_SIZE or RBBIM_TEXT
mov rbbi.wID, IDC_TxtSearch
mov rbbi.fStyle, RBBS_CHILDEDGE or RBBS_FIXEDSIZE
mov rbbi.lpText, CTEXT("Search:")
mov rbbi.lx,0
mov rbbi.cxIdeal, 90
mov rbbi.cxMinChild,90
mov rbbi.cyMinChild,20
mov rbbi.cyChild,20 mov eax, hTxtSearch;hToolBarDefault
mov rbbi.hwndChild, eax
invoke SendMessage,hRebarBif,RB_INSERTBAND,1,ADDR rbbi
; Filter Combo band
mov rbbi.fMask, RBBIM_ID or RBBIM_STYLE or RBBIM_CHILDSIZE or RBBIM_CHILD or RBBIM_SIZE or RBBIM_TEXT
mov rbbi.wID, IDC_CboBifFilter
mov rbbi.fStyle, RBBS_CHILDEDGE or RBBS_FIXEDSIZE
mov rbbi.lpText, CTEXT("Filter:")
mov rbbi.lx,0
mov rbbi.cxIdeal, 150
mov rbbi.cxMinChild,150
mov rbbi.cyMinChild,22
mov rbbi.cyChild,22
mov eax, hCboBifFilter;hToolBarDefault
mov rbbi.hwndChild, eax
invoke SendMessage,hRebarBif,RB_INSERTBAND,2,ADDR rbbi
ret
InitRebar endpThe order I do this all in is via a InitGUI proc called from WM_INITDIALOG event of the main window.
Invoke InitToolBar, hWin, 16, 16
Invoke InitCboBifFilter, hWin
Invoke InitToolBarTxtSearch, hWin
Invoke InitRebar, hWin
-
Thanks fearless. In addition to your example, I’ve found a couple other examples I will look at later today.
-
Upon examine the code I've seen thus far regarding rebar controls, seems would be way easier to just use a static control as the 'toolbar' parent and plonk down the text boxes and other controls needed to do what I want. :biggrin: An example coming at some point later on ...
I envision having a menu item on the menu bar to show the 'search & replace' toolbar. On the toolbar have a button to hide the toolbar when not in use. :cool:
-
seems would be way easier to just use a static control
Rebar is for applications with complex toolbars, allowing resize and several rows if necessary. Not so usefull for little toys.
Toolbar have sense for several options. If you need a button, just use a button in a child window :biggrin:
-
Z,
Don't use a static control for a container, just use a normal CreateWindowEx().
-
Toolbars are ok, but without tooltips they are a bit more difficult to use than menus.
-
... but without tooltips they are a bit more difficult to use ...
For bitmap toolbar buttons perhaps. But...
I specifically excluded those ...
... other than for 'bitmap buttons'?
:tongue: It's all in the details.
-
I use tooltips on some of my editors but display the results on the title bar, much faster and much easier to read.
-
... but display the results on the title bar ...
If I ever did use tooltips (extremely rare) I would probably use the status bar for display. I don't like the 'normal' tooltips.
-
I've settled on creating my search bar and incorporating status bar duties in the same control. It will be a custom toolbar of sorts located in the area normally occupied by a status bar. Will take a bit of coding to insert all the controls I want to add there ... :biggrin:
-
I use tooltips on some of my editors but display the results on the title bar, much faster and much easier to read.
Much faster to code, maybe, but when I move the cursor over a toolbar button, I want to see the help text precisely there, not in some distant corner of the document...
(http://masm32.com/board/index.php?action=dlattach;topic=10548.0;attach=13918;image)
-
:biggrin:
The title bar is not some distant corner of the document, its at the top of the windows just above the toolbar. faster "to use" than laggy little popups.
-
... display the results on the title bar ...
... when I move the cursor over a toolbar button, I want to see the help text precisely there ...
Or you could read the instructions so that you know what each bitmap button does. (RTFM :tongue: )
If it's your own creation, shame on you if you forget what each bitmap button does. :greensml:
At any rate, no bitmaps buttons for me. :tongue:
-
Okay, I have the searchbar/status indicator toolbar controls coded into the test program. :biggrin:
Now time to make it actually do something useful. :tongue: Non functional at this time ...