GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Oct 24, 2014 6:04 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Hiding popup menu without consuming the mouse event
PostPosted: Sun Jun 09, 2013 9:57 am 
Offline
Familiar Face

Joined: Fri Jun 07, 2013 9:20 am
Posts: 6
Hi all,

in my program, I have a tree view on which a context menu opens when rightclicking on it. If I have opened such a context menu, I want to be able to dismiss it and open a new one, by rightclicking next to it on the tree view. The current behaviour is that I first have to dismiss the context menu, and then open a new one, which is way to clumsy for my program.

Is there a way to achieve what I want?

I hope it is clear what I want. I am using gtk+ 3.4, in C.

Thanks in advance, Ale


Top
 Profile  
 
 Post subject: Re: Hiding popup menu without consuming the mouse event
PostPosted: Mon Jun 10, 2013 12:54 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 764
Location: UK
Hello,

There probably is a way to do this, but I think this would be fairly tedious. What you also want to do changes the way most other GTK applications work. So if you do manage to do this your users may find this confusing.

_________________
E.


Top
 Profile  
 
 Post subject: Re: Hiding popup menu without consuming the mouse event
PostPosted: Mon Jun 10, 2013 1:15 pm 
Offline
Familiar Face

Joined: Fri Jun 07, 2013 9:20 am
Posts: 6
Hi,

I have to disagree with you - different programs I use work like that, and in this case it is important for good user-machine interaction. As a large part of the user-machine interaction for my program is using these popup menus it can save a lot of clicking if it works the way I want it to. The context menus are used to edit the tree, which represents a model of a piece of software. It is much like the file browser trees in IDE's. Netbeans for example works as I described.


Top
 Profile  
 
 Post subject: Re: Hiding popup menu without consuming the mouse event
PostPosted: Mon Jun 10, 2013 1:33 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 764
Location: UK
Netbeans is not a GTK application, it is a Java application using the Java tool kit. You are writing a GTK application and I am giving my answers from a GTK+ point of view.

It would be like me saying that I am writing an application on MS Windows 7 and I want to to operate exactly the same and look the same as on MacOS X.

_________________
E.


Top
 Profile  
 
 Post subject: Re: Hiding popup menu without consuming the mouse event
PostPosted: Mon Jun 10, 2013 7:07 pm 
Offline
Familiar Face

Joined: Fri Jun 07, 2013 9:20 am
Posts: 6
Yes, I know it is a Java program, I just wanted to give an example of a program that works as I expect it. In my opinion, the way things work should not be dependent on the toolkit, but on the job the application is trying to get done.


Top
 Profile  
 
 Post subject: Re: Hiding popup menu without consuming the mouse event
PostPosted: Tue Jun 11, 2013 6:10 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 764
Location: UK
The tool-kit will have a great influence on your application. So an application written for Apple's iOS will look and operate differently to the same application ported to an Android. Even between GTK and QT there are great differences.

If you really want to do this you will need to do something along the lines of

1 - Hook up to the button press/release event signals
2 - In the call-back determine where the press/release should go
3 - If to the GtkMenu pass onto the GtkMenu widget
4 - If not to the menu destroy the GtkMenu and pass the button press/release to the widget below
5 - Wait for the widget to process the button press/release by using gtk_idle_add at the lowest priority
6 - In your idle call-back create your new GtkMenu

This has not been tested, may not work and could possibly break on each GTK release.

_________________
E.


Top
 Profile  
 
 Post subject: Re: Hiding popup menu without consuming the mouse event
PostPosted: Tue Jun 11, 2013 9:38 am 
Offline
Familiar Face

Joined: Fri Jun 07, 2013 9:20 am
Posts: 6
Hmm, yes, I had hoped there was a simpler way in GTK. In this case, I'll just mark it as low-priorityand leave it as it is for now and reconsider how important it is later, when the program is more finished.

Thanks for your reply anyway.


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 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
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group