Menu

#308 yad notebook parameter --active-tab

New
None
Medium
Defect
2019-07-21
2018-08-27
No

Hello Victor,

thank you for this great tool !

I have a problem with the notebook parameter --active-tab. It doesn't work as expected.

the following example doesn't work, the tab1 is always the active tab from the start.

1
2
3
4
5
6
7
8
9
#!/bin/bash -xv

id="${RANDOM}"

yad --plug=$id --tabnum=1 --form --columns=4 --scroll --borders=30 &

yad --plug=$id --tabnum=2 --form --columns=4 --scroll --borders=30 &

yad --notebook --key=$id --tab="tab1" --tab="tab2" --active-tab=2 --width=900 --height=600

It should display the tab2 as the active tab, instead the tab1 is always the active tab.

Discussion

  • termino logia

    termino logia - 2018-08-27

    sorry forgot to add some information

    yad --version
    0.40.0 (GTK+ 3.22.30)

     
  • termino logia

    termino logia - 2018-10-20

    strange, no comment or info in 2 months from the maintainer ?!

    is nobody interested in solving this problem ?

    it seems, that the solution of this problem lies in the following file:

    r1117/trunk/src/notebook.c

    function notebook_create_widget

    / set active tab /
    if (options.notebook_data.active <= 0)
    options.notebook_data.active = 1;
    gtk_notebook_set_current_page (GTK_NOTEBOOK (w), options.notebook_data.active - 1);

    Is anyone able to give me a hint ?

     
  • termino logia

    termino logia - 2019-02-02

    Hi Victor,

    hopefully you can read this :-)

    the notebook active tab function works with gtkdialog, an example is shown here:
    http://blogs.czapski.id.au/2017/05/gtkdialog-exploring-the-notebook-object-by-example

    in this example you can define which tab should be the initial active tab in the notebook widget.

    Since i don't want to use gtkdialog or both tools with gtkdialog as a wrapper, i would appreciate it if you could at least confirm this bug in the actual yad version.

    this function was integrated in yad Version 0.39.0
    https://github.com/v1cont/yad/blob/master/NEWS

    another thing is, there are are two sites which claim to host the yad project
    1. Sourceforge
    2. GitHub

    which one is it, or is there a transition in progress ? :-)

    thanks in advance

     
  • Jim Selover

    Jim Selover - 2019-07-21

    The GTK docs say the active tab can only be set after the widget has been shown, I moved setting of the active tab in notbook.c from the notebook_create_widget function to the notebook_swallow_childs function (both in notebook.c) and recompiled.

    The notebook_swallow_childs function is called after the gtk_widget_show_all is called in main.c.

    The --actrive-tab=N option now works for me. I have atttached a patch file for consideration.
    Thanks.

     

    Last edit: Jim Selover 2019-07-21

Log in to post a comment.