Re: Display control with Gtk2 and Glade2



Hi All,

Thanks to all those who had replied to this mail earlier[given below].

I had just thought about one more workaround for this, ie to create a Notebook
widget of 4 pages. Each page, contains the different display widgets that I need[
or rather in other words: Each Page's contents corresponds to a selection of the tree item
in my TreeView] and each page's widgets gets created through Glade-2. This way, I can
create the different widgets in Glade for uniformity.

Based on the user selection in the TreeView, the appropriate page in the
Notebook widget gets displayed.

Now, my question is:
a. Is there a way to have only one page of a Notebook enabled and
the remaining pages disabled, can their sensitivity be set to FALSE?
[Just checked that set_sensitive() does not work on pages], Is there anything
that I am missing here?

b. I tried another way, wherein I have only one page displayed
at a time in the Notebook widget[based on the tree selection]. I destroy
the other widgets not required and recreate them when required.
For this, I tried the following code as well, where based on the tree selection
[in the example code below, the tree selections are 'display' and 'message'],
I have only one page displayed[and I remove the other pages]:
 if ( $value eq "display" ) {
        my $current_page = $NoteBook_Right->get_current_page();
        print "This is current page $current_page\n";
        $NoteBook_Right->append_page($page_1, "Param");
        $NoteBook_Right->next_page;
        $NoteBook_Right->remove_page($current_page);
        #set_current_page(2);
    } elsif ( $value eq "message" ) {
        my $current_page = $NoteBook_Right->get_current_page();
        $NoteBook_Right->append_page($page_0, "Enum");
        $NoteBook_Right->next_page;
        $NoteBook_Right->remove_page($current_page);
    }

However, if I keep toggling the treeviews between the values 'display' and
'message', I end up with a crash with the following information:
Gtk-WARNING **: Can't set a parent on widget which has a parent
This is the depth of the iter 2:1:0:1
Gtk-ERROR **: file gtkcontainer.c: line 2447 (gtk_container_propagate_expose): assertion failed: (child->parent == GTK_WIDGET (container)) at /usr/share/tools/ddore_4.pl line 729.
Aborted

Any mistake here?

Any help in this regard will be highly appreciated.

Thanks and Regards,
Ashwin

Note: I am replying from a different mail id, since my earlier id had a  Disclaimer , which could not be removed
[Apologies]







--------------------------------------------------- Earlier Mail -----------------------------------------------------------------------------------------------------
Hi All,

I have a query regarding Glade2 and Gtk2, regarding the control of display
and is as below:

The main window of my application is divided into two Vboxes.
The left Vbox contains a TreeView and the display on the right Vbox is controlled
through the selection of the TreeView.
For eg: for one particular treeitem selection[on the left side], the right Vbox
can contain a Table widget with 10 columns and 2 rows.
For another treeitem selection[on the left side], the right side can contain
just a label and text widgets.

I have got the basic infrastructure up through Glade-2 and perl-Gtk2[like adding the
TreeView on the leftside]. However, I am not sure, as to how to change the display
on the right side based on the tree selection. It will be better if I could create
the different right display widgets also through Glade-2. More information on the window
layout is given towards the end of this mail.

I have done the above without using Glade2, by destroying and creating different
widgets on the right display, whenever the tree item selection/deselection signal is caught.

It would be helpful, if someone can throw light on how to control
the dynamic display on the right side using Glade2 and Gtk2.

Any help in this regard will be highly appreciated.

I am not sure, whether this is the right list to ask this query.
Apologize for any inconvenience caused.


Thanks
Ashwin


Window Layout
==============

The main window of my application is as below:

---------------------------------------------------
| File Edit View Help                      |
|--------------------------------------------------
|                      |                             |
|+ Imports        |                             |
|  - file1            |   Name:    ---------   |
|  - file2            |                            |
|                      |  Help:     ---------     |
|+ Information   |                            |
|                      |  Display:  --------    |
|  -Info1           |                             |
|  -Info2           |                             |
|                     |                             |
-----------------------------------------------------


The left display of the main window, is a tree view and the right side
is a Table widget with a collection of widgets[label and Text widgets].
Based on the selection in the tree view, the right display changes for eg:
If file1 is selected, only Name and Help Column widgets need to be displayed.

If Info1 is selected, then a different widget class needs to be displayed on the right side


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