It is currently Mon Jan 20, 2020 9:02 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Toolbar button w/ drop down?
PostPosted: Tue Nov 22, 2011 4:39 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Feb 17, 2010 12:00 am
Posts: 1324
Location: (Embarrassed to say country)
Am I right in that there is no native "drop down" toolbar item?


Top
 Profile  
Reply with quote  
 Post subject: Re: Toolbar button w/ drop down?
PostPosted: Tue Nov 22, 2011 5:41 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5953
Location: Wales, UK
Well, there isn't a native toolbar to drop it from.......

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: Toolbar button w/ drop down?
PostPosted: Tue Nov 22, 2011 6:03 pm 
Offline
Addict
Addict

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1617
Location: Somewhere in the midwest
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

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Toolbar button w/ drop down?
PostPosted: Tue Nov 22, 2011 6:16 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5953
Location: Wales, UK
...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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Toolbar button w/ drop down?
PostPosted: Tue Nov 22, 2011 6:21 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 17, 2009 10:51 pm
Posts: 1338
Location: Nashville
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.


This would be my guess. :wink:

_________________
Fangbeast for President!


Top
 Profile  
Reply with quote  
 Post subject: Re: Toolbar button w/ drop down?
PostPosted: Tue Nov 22, 2011 8:20 pm 
Offline
Addict
Addict

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1617
Location: Somewhere in the midwest
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.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Toolbar button w/ drop down?
PostPosted: Tue Nov 22, 2011 9:40 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 8012
Location: Fort Nelson, BC, Canada
It's actually pretty easy with a popup menu, if all you're looking for is a dropdown with options:
Code:
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

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject: Re: Toolbar button w/ drop down?
PostPosted: Tue Nov 22, 2011 11:45 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5953
Location: Wales, UK
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Toolbar button w/ drop down?
PostPosted: Wed Nov 23, 2011 7:07 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Feb 17, 2010 12:00 am
Posts: 1324
Location: (Embarrassed to say country)
netmaestro wrote:
It's actually pretty easy with a popup menu, if all you're looking for is a dropdown with options:


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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye