Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Menus&Toolbars » ToolBar enabling and disabling question
Re: ToolBar enabling and disabling question [message #21454 is a reply to message #21451] Thu, 21 May 2009 15:47 Go to previous messageGo to previous message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

koldo wrote on Thu, 21 May 2009 13:12

Hello all

Just a simple question.

I want to enable or disable an option in a ToolBar depending in this case if a text has been changed or not.

index.php?t=getfile&id=1731&private=0

For a MenuBar it is easy to do it, but for a ToolBar I do not know the way.

I have tried to do it by a Timer function that calls every 3 seconds to UpdateLayout() and other functions, bot no success.

How can I force a ToolBar to update its layout?.

Best regards
Koldo


It is same as MenuBar

Locking to uppsrc is two method:
1. if you set a control, set enable or disable this control
2. if is calback with text or/and image

you need use this method
Bar::Item&  Bar::Add(bool enable, const UPP::Image& image, Callback cb)


and example you can find in uppsrc/ide/idebar.cpp at line 379 like this:
void Ide::BuildMenu(Bar& menu) {
..........
	b = b && idestate == EDITING; // set enable or disable
=>HERE	menu.Add(b, AK_CLEAN, THISBACK(Clean))
		.Help("Remove all intermediate files");
.............
}

and every time when you want to refresh bar you need call like this:
YOUR_TOOLBAR_CTRL_OBJECT.Set(THISBACK(YOR_CONSTRUCTOR_BAR_FUNCTION));
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Only one additional argument for Bar callback?
Next Topic: Disable/Enable Menu item during runtime
Goto Forum:
  


Current Time: Mon May 12 01:17:23 CEST 2025

Total time taken to generate the page: 0.00338 seconds