www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [ gtkD ] Question about mouse press event in Notebook ...

reply "Super666666Super" <super666666super gmail.com> writes:
I'm programming in gtkD on Funtoo Linux.
I want to catch mouse press event in Notebook, but I would like 
to don't touch the tabs and their contents.
I'm using function: addOnButtonPress () in Notebook,
but after that the tabs aren't reorderable ( previously yes ).
Or similarly, how to catch mouse events only on the selected 
window / widget without touching it's children.
Thanks for any help.
Apr 22 2013
next sibling parent "angel" <andrey.gelman gmail.com> writes:
Not being able to provide a real answer, I can give you an advice 
...
Look how this issue could be solved for 'general' gtk+. As GtkD 
is a wrapper on gtk+, the answer to your question should not be 
D-specific.
Apr 22 2013
prev sibling next sibling parent Mike Wey <mike-wey example.com> writes:
On 04/22/2013 12:05 PM, Super666666Super wrote:
 I'm programming in gtkD on Funtoo Linux.
 I want to catch mouse press event in Notebook, but I would like to don't
 touch the tabs and their contents.
 I'm using function: addOnButtonPress () in Notebook,
 but after that the tabs aren't reorderable ( previously yes ).
 Or similarly, how to catch mouse events only on the selected window /
 widget without touching it's children.
 Thanks for any help.
If you are not doing so already, try returning false from the function you pass to addOnButtonPress so it doesn't stop the event from propagating. -- Mike Wey
Apr 22 2013
prev sibling next sibling parent reply "Super666666Super" <super666666super gmail.com> writes:
"Look how this issue could be solved for 'general' gtk+. As GtkD 
is a wrapper on gtk+, the answer to your question should not be 
D-specific."

Hmmm ...
Thanks, but I'm not sure is it a real bug.

"If you are not doing so already, try returning false from the 
function you pass to addOnButtonPress so it doesn't stop the 
event from propagating."

Better ...
But it isn't exactly solved my problem ...

I created a simple window without decorations, and I added the 
Notebook to the window.
I want to add the ability to move the window after capturing the 
left mouse button press event on Notebook.

When I return true I can only move window.
When I return false I can move window and switch between tabs.
I can't reorder my tabs. I can do it after comment out the line 
with addOnButtonPress ().

My code is:
http://pastebin.com/dz6XZZj6
Compiled successful ...

Is it a bug ?
I think it's my mistake ...

P.S.
Sorry for my English.

Thanks for your help.
Apr 22 2013
parent Mike Wey <mike-wey example.com> writes:
On 04/22/2013 10:48 PM, Super666666Super wrote:
 "Look how this issue could be solved for 'general' gtk+. As GtkD is a
 wrapper on gtk+, the answer to your question should not be D-specific."

 Hmmm ...
 Thanks, but I'm not sure is it a real bug.

 "If you are not doing so already, try returning false from the function
 you pass to addOnButtonPress so it doesn't stop the event from
 propagating."

 Better ...
 But it isn't exactly solved my problem ...

 I created a simple window without decorations, and I added the Notebook
 to the window.
 I want to add the ability to move the window after capturing the left
 mouse button press event on Notebook.

 When I return true I can only move window.
 When I return false I can move window and switch between tabs.
 I can't reorder my tabs. I can do it after comment out the line with
 addOnButtonPress ().

 My code is:
 http://pastebin.com/dz6XZZj6
 Compiled successful ...

 Is it a bug ?
 I think it's my mistake ...

 P.S.
 Sorry for my English.

 Thanks for your help.
The begingMoveDrag call in mousepressevent makes it so that you drag the window around when holding the left mouse on on of the tabs. And that prevents you from reordering the tabs. What are you trying to achieve with mousepressevent? -- Mike Wey
Apr 22 2013
prev sibling parent reply "Super666666Super" <super666666super gmail.com> writes:
"The begingMoveDrag call in mousepressevent makes it so that you 
drag the window around when holding the left mouse on on of the 
tabs. And that prevents you from reordering the tabs."
I understand, thanks for the valuable information.

"What are you trying to achieve with mousepressevent?"
I want to:
*have undecorated window with Notebook - ok, no problem
*reorderable tabs - ok, no problem
*begin move window when press on Notebook - I need that

Can I check if the mouse is above a tab in Notebook with mouse 
move / motion event ?
If I could do it, then I can put a condition that checks it and 
assigns a value to a Boolean variable.
Thus, in the event of pressing the left mouse button I check this 
variable and dependent on this I can move a window or not.
Apr 22 2013
parent reply Mike Wey <mike-wey example.com> writes:
On 04/23/2013 08:13 AM, Super666666Super wrote:
 "The begingMoveDrag call in mousepressevent makes it so that you drag
 the window around when holding the left mouse on on of the tabs. And
 that prevents you from reordering the tabs."
 I understand, thanks for the valuable information.

 "What are you trying to achieve with mousepressevent?"
 I want to:
 *have undecorated window with Notebook - ok, no problem
 *reorderable tabs - ok, no problem
 *begin move window when press on Notebook - I need that
You will need to add the event handler to the containers you are addin to the page. And in the case of the small example you posted, where you add only a single Label to the page it needs to be wrapped in an EventBox. Is far as i know that shouldn't be necessary when you are adding an other container to the page. http://dpaste.dzfl.pl/adc350a4
 Can I check if the mouse is above a tab in Notebook with mouse move /
 motion event ?
 If I could do it, then I can put a condition that checks it and assigns
 a value to a Boolean variable.
 Thus, in the event of pressing the left mouse button I check this
 variable and dependent on this I can move a window or not.
-- Mike Wey
Apr 23 2013
parent reply "Super666666Super" <super666666super gmail.com> writes:
Sorry, you don't understand me.

I want something like this:

/------------------------------Frameless 
Window----------------------------------\
|*First Reordalable tab* | *Second ...* || Rest - drag this to 
begin move window |
|*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*|
|                                                                 
                |
|                                                                 
                |
|                           Tab content - not this !              
                |
|                                                                 
                |
|                                                                 
                |
|                                                                 
                |
\--------------------------------------------------------------------------------/

I know that function addOnButtonPressd() prevents change the 
order of the tabs ...

Did you have any idea ?

Thanks for your time.
Apr 23 2013
next sibling parent "Super666666Super" <super666666super gmail.com> writes:
And sorry for bad ASCI sample ...
You should copy it to your favorite text editor.
Sorry ...
Apr 23 2013
prev sibling parent reply Mike Wey <mike-wey example.com> writes:
On 04/24/2013 08:43 AM, Super666666Super wrote:
 Sorry, you don't understand me.

 I want something like this:

 ....ACII ART....

 I know that function addOnButtonPressd() prevents change the order of
 the tabs ...

 Did you have any idea ?

 Thanks for your time.
I see what you mean, using the enterNotify and leaveNotify events you can track if the mouse is over an tab and skip the mousePress event. The tab label do need to be wrapped in an EventBox for this to work. http://dpaste.dzfl.pl/3bb9ab78 -- Mike Wey
Apr 24 2013
parent "Super666666Super" <super666666super gmail.com> writes:
It works !
Really, really thanks !
Apr 24 2013