GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GtkExpander: how to minimize it

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
cofcof
Familiar Face


Joined: 02 Apr 2008
Posts: 29

PostPosted: Sun May 18, 2008 4:07 am    Post subject: GtkExpander: how to minimize it Reply with quote

Hi All.

I am using a GtkExpander such that the user access to the help
by clicking on the little arrow to expand the text. However, when the user click again on the arrow, the text diseappear (that's good) but the expander still take the same amount of space (that's not good) instead of shrinking itself (and the windows containing it)

Does anyone know to make it possible that the expander shrink back to it's initial size?

Cheers

CofCof
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 474
Location: Portland, OR USA

PostPosted: Mon May 19, 2008 3:50 am    Post subject: Reply with quote

This comes down to how the expander is packed and how other child elements of it's parent are packed. First thing I would think is that you should change the "expand" and "fill" properties of the GtkExpander to FALSE.

If you don't entirely understand packing in GTK, it's worth reading up on. I present some examples in my tutorial: http://www.micahcarrick.com/12-24-2007/gtk-glade-tutorial-part-1.html#How_Packing_Effects_the_Layout
Back to top
cofcof
Familiar Face


Joined: 02 Apr 2008
Posts: 29

PostPosted: Tue May 20, 2008 4:14 am    Post subject: Reply with quote

Hi Micah

Thanks for your suggestion, but it doesn't solve my problem :(

In fact i have done a minimalistic glade file to illustrate my example,
and there is no 'expand' nor 'fill' proprieties available for the widget I use
(The propriety fill or expand is not made available for those widget by glade, as far as I understand because there is no container like Hbox or stuff like that that I use for this example)

This is my minimalistic example (see picture):
1. At start
2. When I expand the expander
3. When I un-expand the expander.
I would like 3. to come back to something close to 1.


Here is the glade file:


Code: (XML/HTML)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--*- mode: xml -*-->
<glade-interface>
  <widget
class="GtkWindow" id="window">
    <property
name="visible">True</property>
    <property
name="title" translatable="yes">window</property>
    <child>
      <widget
class="GtkExpander" id="expander1">
        <property
name="visible">True</property>
        <property
name="can_focus">True</property>
        <property
name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
        <child>
          <widget
class="GtkLabel" id="label2">
            <property
name="visible">True</property>
            <property
name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
            <property
name="label" translatable="yes">Hello how are you?
Fine! Exept I can't solve
this expander problem :(
Helpppppppp :)
</property>
          </widget>
        </child>
        <child>
          <widget
class="GtkLabel" id="label1">
            <property
name="visible">True</property>
            <property
name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
            <property
name="label" translatable="yes">expander</property>
          </widget>
          <packing>
            <property
name="type">label_item</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>


Thanks for any help :)

CofCof
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 474
Location: Portland, OR USA

PostPosted: Tue May 20, 2008 6:28 am    Post subject: Reply with quote

Change the resize property of the window to "FALSE" so that it snaps around the expander as it's size changes. It's the same concept as expand and fill in something like a GtkBox.
Back to top
cofcof
Familiar Face


Joined: 02 Apr 2008
Posts: 29

PostPosted: Tue May 20, 2008 8:18 am    Post subject: Reply with quote

Thanks Micah

That's what I was looking for :)

CofCof
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP