[Gtk-sharp-list] Toggled state change and events
Gennadiy Donchyts
don at env.com.ua
Tue Dec 6 22:28:49 EST 2005
On 12/7/05, John Russell <jjrussell at gmail.com> wrote:
>
> A few weeks ago someone posted this question to the mailer and didn't
> recieve an answer. I have exactly the same question. Does anyone know
> how to do this? Thanks..
>
> Its essentially how to synchronize two separate toggle buttons that
> need to reflect the state of the UI that can be changed outside of the
> buttons. However, setting them active if the UI reflects that causes
> a toggled event. Is there a common workaround for this? Thanks for
> the help.
I've found only temporary solution by remembering by accepting that evend is
called twice,
simply counting it :), so menu item and toolbar button call the same handler
(both on toggled signal)
in which I've put:
if(trigger == 0)
{
trigger++;
bool visible = ( (sender == menuItem) ? !toolButton.Active :
!menuItem.Active ); // arhh!
menuItem.Active = visible;
button.Active = visible;
}
else
{
trigger = 0;
}
hope it helps...
--Gena
John
>
>
> Original post.
> **********************
> [Gtk-sharp-list] ToggleToolButton, CheckMenuItem, active, tooggled signals
>
> Gennadiy Donchyts
> Wed, 16 Nov 2005 12:52:12 -0800
>
> Hi all,
> sorry for some stupid newbie questions, I'm stucked with
> synchronization of the 2
> widgets' state, I have and application with Glade file (menu item and
> toolbar button
> are created there). In the glade I also add toggled signal for the
> CheckMenuItem
> menu; and ToggleToolButton button; on a toolbar. they both are
> connected to something like OnWindowToggled() function, how can I do
> the next:
>
> private void OnWindowToggled(...)
> {
> window.Visible = !window.Visible;
> menu.Active = window.Visible;
> buton.Active = window.Visible;
> }
>
> Is there some universal property/method which could set Checked / Toggled
> property of these 2 widgets *without* rising a toggled event?? ...
> lost a bit ...
>
> I've been plaing with the State property in the ToggleToolButton but there
> are
> also some problems with it and in CheckMenuItem there is no such thing ...
> (or at least I did not succeed to get it running in a good way).
>
> I liked Gtk# a lot but after using SFW it sometimes not very intuitive
> :) (that's why
> refference manual exists of course :), but they are still not complete
> also. By the
> way I liked a lot tutorials / help on Mono's Mediawiki - good job! (I
> would like to
> have tutorial on Toggled / Checked controls there, even could write myself
> when
> will understand them clearly).
>
> it would be nice to have:
>
> checkItem.Checked - calls signal/event
> checkItem.SetChecked(bool) - changes state without signal
> toggleItem.Toggled - toggles and calls signal/event
> toggleItem.SetToggled(bool) - changes toggled state without signal
> -----
> Another thing is regarding widgets you use in MonoDevelop, there is a
> comment
> that they are licensed using Novell license but MD uses GPL. Are there
> plans to
> make something like higher-level Widgets library (TreeView, PropertyGrid,
> Commands, Docking, etc.) and release them using less restrictive license?
> It would be nice to have them as a separate project. (I guess it should be
> in MD
> list.. sorry).
> -----
>
> Thanks in advance
> --Gena
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20051207/ec80a770/attachment.html
More information about the Gtk-sharp-list
mailing list