Toolbar button w/ drop down?
Toolbar button w/ drop down?
Am I right in that there is no native "drop down" toolbar item?
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Toolbar button w/ drop down?
Well, there isn't a native toolbar to drop it from.......
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
- Addict
- Posts: 1656
- Joined: Sun Dec 12, 2010 12:36 am
- Location: Somewhere in the midwest
- Contact:
Re: Toolbar button w/ drop down?
I think he means a selection box, like the selection boxes on an Open File dialog to choose the file type filter, or recall a previously entered path/file
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Toolbar button w/ drop down?
...I think it is an icon toolbar where holding the left-mouse on a toolbar button invokes a drop-down toolbar of other buttons.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Toolbar button w/ drop down?
This would be my guess.IdeasVacuum wrote:...I think it is an icon toolbar where holding the left-mouse on a toolbar button invokes a drop-down toolbar of other buttons.
Best wishes to the PB community. Thank you for the memories.
-
- Addict
- Posts: 1656
- Joined: Sun Dec 12, 2010 12:36 am
- Location: Somewhere in the midwest
- Contact:
Re: Toolbar button w/ drop down?
Oh, those things..
Only place I've seen something similar to them available is in using ProGUI. I think you need to use a Rebar to get those. But assuming you can conjur up a Rebar via API, I would assume it can be done in standard PB.
It is demonstrated in RebarExample2.exe and ToolBarExample.exe from the samples pack download.
Only place I've seen something similar to them available is in using ProGUI. I think you need to use a Rebar to get those. But assuming you can conjur up a Rebar via API, I would assume it can be done in standard PB.
It is demonstrated in RebarExample2.exe and ToolBarExample.exe from the samples pack download.
- netmaestro
- PureBasic Bullfrog
- Posts: 8433
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Toolbar button w/ drop down?
It's actually pretty easy with a popup menu, if all you're looking for is a dropdown with options:
Code: Select all
Procedure WinProc(hwnd, msg, wparam, lparam)
result=#PB_ProcessPureBasicEvents
Select msg
Case #WM_NOTIFY
*nmt.NMTOOLBAR = lparam
Select *nmt\hdr\code
Case #TBN_DROPDOWN
MapWindowPoints_( WindowID(0), 0, *nmt\rcButton, 2)
DisplayPopupMenu(1, WindowID(0),*nmt\rcButton\left,*nmt\rcButton\bottom)
ProcedureReturn 0
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(0, 100, 200, 640, 480, "ToolBar example", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
SetWindowCallback(@WinProc())
bar = CreateToolBar(0, WindowID(0))
SendMessage_(bar, #TB_SETBUTTONSIZE, 0, 48|24<<16)
SendMessage_(bar, #TB_SETEXTENDEDSTYLE, 0, #TBSTYLE_EX_DRAWDDARROWS)
ToolBarStandardButton(0, #PB_ToolBarIcon_New)
ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
With tbbi.TBBUTTONINFO
\dwMask = #TBIF_BYINDEX|#TBIF_STYLE
\cbSize = SizeOf(TBBUTTONINFO)
EndWith
SendMessage_(bar, #TB_GETBUTTONINFO, 2, @tbbi)
tbbi\fsStyle|#BTNS_DROPDOWN
SendMessage_(bar, #TB_SETBUTTONINFO, 2, @tbbi)
If CreateMenu(0, WindowID(0))
MenuTitle("Project")
MenuItem(0, "New")
MenuItem(1, "Open")
MenuItem(2, "Save")
EndIf
CreatePopupMenu(1)
MenuItem(9, "Option 1")
MenuItem(10, "Option 2")
MenuItem(11, "Option 3")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Menu
MessageRequester("Information", "ToolBar or Menu ID: "+Str(EventMenu()), 0)
Case #PB_Event_CloseWindow
Quit=1
EndSelect
Until Quit
BERESHEIT
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Toolbar button w/ drop down?
Well, the first lesson learnt from netmaestro's excellent code is - scroll down to the bottom of the help menu! I never knew CreateToolBar was there (may be because I expected it to be described as a Gadget).
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Toolbar button w/ drop down?
Thanks for the example... I'm doing some work; and the client is leaning towards RealBasic; so I want to be sure I can do everything their asking in PureBasic...netmaestro wrote:It's actually pretty easy with a popup menu, if all you're looking for is a dropdown with options: