Re Firefly 2.5, PB 8.01 Win XP
I have successfully implemented a basic toolbar in my Firefly based project using the Firefly Toolbar Editor but need to extend the application by way of controling the various toolbar button properties. ie: I would like to enable and disable the buttons and would also like to gray the buttons out etc.
The problem is I cannot seem to obtain the windows handle of the Toolbar to use in the API Sendmessage functions. Firefly does not appear to make this available through the Handles and ControlIDs utility.
Can anyone assist here. :?
Further, I note that the Firefly Toolbar editor allows the toolbar buttons to have the TBSTYLE_DROPDOWN Style. I cannot find reference to this Style in the Win32API Help file???
The reason I am looking at this style is that I am basically trying or wishing to implement a dropdown combo or list box on the toolbar to allow font selection etc.
Has anyone also experienced this or can assist me in achieving this with Firefly.
Any help appreciated. :?
Regards
Gian Young
Dataman Barcode Australia
Hi Gian,
You should be able to get the hwnd of the toolbar using the following type of code:
Local hToolbar As Dword
hToolbar = GetDlgItem( hWndForm, IDC_FORM1_TOOLBAR1 )
MsgBox Str$( hToolbar )
In order to deal with a toolbar button's dropdown, you need to respond to the notification sent to the parent form by the button. For example:
Function FORM1_CUSTOM ( _
hWndForm As Dword, _ ' handle of Form
wMsg As Long, _ ' type of message
wParam As Dword, _ ' first message parameter
lParam As Long _ ' second message parameter
) As Long
Local nmtb As TBNOTIFY Ptr
Select Case wMsg
Case %WM_NOTIFY
nmtb = lParam
If @nmtb.hdr.code = %TBN_DROPDOWN Then
MsgBox "drop down pressed"
End If
End Select
End Function
Thank you Paul for your response.
I will give this a try to see if I can make progress.
Any other code examples in this area still welcome as I believe it would assist others as well as me
Regards
Gian
QuoteI would now like to figure out how to place a dropdown List box or Combo box on the Toolbar. If anyone has ideas or can assist their efforts would be appreciated.
I think that a quick solution would be to create a Combobox anywhere on your Form and then move it into place (on your Rebar control) in the %WM_SIZE message handler.
SetWindowPos HWND_FRMMAIN_COMBO1, %HWND_TOP, 200, 3, 0, 0, %SWP_NOSIZE
Change the 200 (left) and 3 (top) to values that are appropriate to your situation. You will notice that even though the Combobox is displayed on top of the Rebar control, the Combobox's parent window is still the Form.
QuoteI would now like to figure out how to place a dropdown List box or Combo box on the Toolbar. If anyone has ideas or can assist their efforts would be appreciated.
I think that a quick solution would be to create a Combobox anywhere on your Form and then move it into place (on your Rebar control) in the %WM_SIZE message handler.
SetWindowPos HWND_FRMMAIN_COMBO1, %HWND_TOP, 200, 3, 0, 0, %SWP_NOSIZE
Change the 200 (left) and 3 (top) to values that are appropriate to your situation. You will notice that even though the Combobox is displayed on top of the Rebar control, the Combobox's parent window is still the Form.
Thank you Paul for this latest suggestion.
I was looking for a much more complicated method when the simpler solution was right under my nose.
Regards
Gian