Re: Can anyone tell me how to make a floating window?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 --- John Cupitt <john.cupitt@xxxxxxxxxxxxxxxx> wrote: > Hi Jack,
> 
> Jack Chen wrote:
> > Hi, can anyone please tell me how I can make a "floating window", a
> > window, dialog, or popup on top of my main window, like the one
> that
> > contains all the drawing tools and can be moved around in
> Photoshop? 
> 
> Take a look at the docs for gtk_window_set_type_hint() and
> gtk_window_set_transient_for(). You make a regular GtkWindow, set the
> hints, link it to the parent, and then fill it with your tool
> buttons.
> 
Hey thanks, John,
   I did what you said yesterday, and got what I wanted with
gtk_window_set_transient_for(). But I don't know what
gtk_window_set_type_hint() is for. I checked the gtk reference manual
and it didn't say what the "hint", which is one of the parameters I
need to pass, was. Do you mind telling me how to use this function?

> > Also can someone please tell me how to do something like when you
> press
> > a button, for example - "settings", and then a new window pops up
> with
> > all the configuration options? I just need to know how to create a
> new
> > window and show it.
> 
> Very easy, something like:
> 
>   new_window = gtk_window_new( GTK_WINDOW_POPUP );
>   gtk_window_set_transient_for( new_window, main_window );
>   fill_window_with_stuff( new_window );
>   gtk_widget_show( new_window );
> 

Thank you, that's exactly what I needed! I then made a window just like
that, but there's a new problem. I set the initial floating window's
position with gtk_window_move(), and set it to be unresizable. And when
I dragged the left edge to expand it the "whole window" moved to the
right, and when it moved to the right its left edge wasn't even under
my mouse. Is it a bug in gtk?

Also I've noticed that just like with Gimp, whenever I drag a child
window across its parent the parent never updates itself, unless I let
go the left button of my mouse, but that way it looks pretty ugly
because I can erase my whole parent window by dragging the child window
around. Do you know the solution for this? I tried to add an idle
function to make the parent update itself constantly, but it's no use.

Also, do you know a way to create a window that has a border, and a
title bar with no icon and no max/min/close buttons, and it's actually
draggable by using its title bar? That is what I want to create for my
application.


> You might find it helpful to look through another gtk application for
> tips. Gimp is huge, but really pretty easy to read.
> 
> John

Thank you. I will do as you suggested. Once I get my internet
connection back at home I'll download Gimp's source. Thanks a lot! I
really appreciate your help.

Best wishes,

Jack

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux