I'm getting crazy trying to enable/disable a button over a toolbar inside a rebar band/rebar
Based on application situations I need to enable/disable some of the buttons.
Maybe I'm blind and solution is just under my eyes but ...
I need to Enable the "Bundle" button (see image)
Hi Eros,
FF_Control_Enable does not work on individual toolbar buttons. You should use the WinAPI TB_ENABLEBUTTON message. The best solution is to use Jose's wrappers for the ToolBar control. I use Jose's wrappers for everything I do these days.
http://www.planetsquires.com/protect/forum/index.php?topic=3597.0
Check out the ToolBar function "Toolbar_EnableButton"
Perfect.
Thanks a lot.
PS: I'm also migrating to Jose wrappers step by step but have so many thousand lines to change from old school :)
FF_Control_Enable can't work with toolbar buttons because they aren't "real" buttons, but drawn by Windows.
Thanks a lot.
I've found how to do using Jose functions ToolBar_DisableButton and ToolBar_EnableButton
Example:
ToolBar_DisableButton(gfrmMainToolBarHandle, IDC_FRMMAIN_TOOLBAR_BUNDLE_BUTTON_BUNDLE)
ToolBar_EnableButton(gfrmMainToolBarHandle, IDC_FRMMAIN_TOOLBAR_BUNDLE_BUTTON_CANCEL)
Or using the API you could use:
hToolBar = GetDlgItem( HWND_FRMMAIN, IDC_FORM1_TOOLBAR1 )
SendMessage hToolBar, %TB_SETSTATE, IDC_FORM1_TOOLBAR1_CUSTINFO, %TBSTATE_DISABLED
Rolf
And of course to enable:
SendMessage hToolBar, %TB_SETSTATE, IDC_FORM1_TOOLBAR1_CUSTINFO, %TBSTATE_DISABLED
Rolf