• Gtk.Image.Gtk_Image

    From Thomas@21:1/5 to All on Thu Mar 24 13:55:04 2022
    Hi :-)


    To display images, I had a Gtk.Pixmap.Gtk_Pixmap in a Gtk.Event_Box.Gtk_Event_Box.

    Since Gtk.Pixmap is obsolescent, I try to replace it by
    Gtk.Image.Gtk_Image.


    When I replace Gtk.Pixmap.Gtk_Pixmap by Gtk.Image.Gtk_Image, it doesn't
    work.

    Why? What's specific to Gtk_Pixmap or Gtk_Image so it has not the same
    behavior in Gtk_Event_Box?


    When I replace Gtk.Event_Box.Gtk_Event_Box by Gtk.Image.Gtk_Image, it
    works fine, except the replacement by an other image.
    (I try it using Gtk.Image.Get and Gtk.Image.Set, but it doesn't work.)

    Is there an other container, that I should use instead of Gtk.Event_Box.Gtk_Event_Box that would work and that I should use
    to replace the image inside?

    --
    RAPID maintainer
    http://savannah.nongnu.org/projects/rapid/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dmitry A. Kazakov@21:1/5 to Thomas on Thu Mar 24 14:35:29 2022
    On 2022-03-24 13:55, Thomas wrote:

    To display images, I had a Gtk.Pixmap.Gtk_Pixmap in a Gtk.Event_Box.Gtk_Event_Box.

    Since Gtk.Pixmap is obsolescent, I try to replace it by
    Gtk.Image.Gtk_Image.


    When I replace Gtk.Pixmap.Gtk_Pixmap by Gtk.Image.Gtk_Image, it doesn't
    work.

    Why? What's specific to Gtk_Pixmap or Gtk_Image so it has not the same behavior in Gtk_Event_Box?


    When I replace Gtk.Event_Box.Gtk_Event_Box by Gtk.Image.Gtk_Image, it
    works fine, except the replacement by an other image.
    (I try it using Gtk.Image.Get and Gtk.Image.Set, but it doesn't work.)

    Is there an other container, that I should use instead of Gtk.Event_Box.Gtk_Event_Box that would work and that I should use
    to replace the image inside?

    I don't know what are you trying to achieve. If you want to change a
    child of a container, remove the old child and add a new one.

    Another method of doing "animation" through a set of images is by using
    a Gtk_Box. Add all images to the box use Hide on all of them and Show on
    the one show.

    If you want drawing use Gtk_Drawing_Area, Cairo and event "draw"
    handler. Use Gdk_Pixbuf for drawing a whole image.

    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas@21:1/5 to Dmitry A. Kazakov on Thu Mar 24 16:14:16 2022
    In article <t1hs30$s7j$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    On 2022-03-24 13:55, Thomas wrote:

    To display images, I had a Gtk.Pixmap.Gtk_Pixmap in a Gtk.Event_Box.Gtk_Event_Box.

    Since Gtk.Pixmap is obsolescent, I try to replace it by Gtk.Image.Gtk_Image.


    When I replace Gtk.Pixmap.Gtk_Pixmap by Gtk.Image.Gtk_Image, it doesn't work.

    Why? What's specific to Gtk_Pixmap or Gtk_Image so it has not the same behavior in Gtk_Event_Box?


    When I replace Gtk.Event_Box.Gtk_Event_Box by Gtk.Image.Gtk_Image, it
    works fine, except the replacement by an other image.
    (I try it using Gtk.Image.Get and Gtk.Image.Set, but it doesn't work.)

    Is there an other container, that I should use instead of Gtk.Event_Box.Gtk_Event_Box that would work and that I should use to replace the image inside?

    I don't know what are you trying to achieve.

    sorry, sometimes I don't know what to write to be clear.


    i'm trying to implement these interfaces :

    http://svn.savannah.gnu.org/viewvc/rapid/branches/gtkada-2.24/src/tki/mcc _tki/mcc-tki-image.ads?view=markup&pathrev=257
    ( https://urlpetite.fr/hfd )

    http://svn.savannah.gnu.org/viewvc/rapid/branches/gtkada-2.24/src/tki/mcc _tki/mcc-tki-widget-picture.ads?view=markup&pathrev=257
    ( https://urlpetite.fr/olk )

    http://svn.savannah.gnu.org/viewvc/rapid/branches/gtkada-2.24/src/tki/mcc _tki/mcc-tki-widget-button-picture.ads?view=markup&pathrev=257
    ( https://urlpetite.fr/p48 )


    it was done with a very old version of gtkada.
    i'm with gtkada-2.24. it works, but it uses some components that were
    already Obsolescent in gtkada-2.24, like Gtk.Pixmap.

    of ourse the goal is to update it to the latest version of gtkada.
    to make it easier, an intermediate step is to update it properly to gtkada-2.24, without Obsolescent components.



    If you want to change a
    child of a container, remove the old child and add a new one.


    i edited the corresponding bodies :

    http://svn.savannah.gnu.org/viewvc/rapid/branches/gtkada-2.24/src/peers/G tk/mcc-tki-image.adb?view=markup&pathrev=257
    ( https://urlpetite.fr/2uf )

    http://svn.savannah.gnu.org/viewvc/rapid/branches/gtkada-2.24/src/peers/G tk/mcc-tki-widget-picture.adb?view=markup&pathrev=257
    ( https://urlpetite.fr/nso )

    http://svn.savannah.gnu.org/viewvc/rapid/branches/gtkada-2.24/src/peers/G tk/mcc-tki-widget-button-picture.adb?view=markup&pathrev=257
    ( https://urlpetite.fr/gl3 )


    for mcc.tki.Image.External_Image i use Gtk.Image.Gtk_Image.

    for mcc.tki.Widget.Button.Picture.Picture_Button i keep
    Gtk.Button.Gtk_Button,
    and both Create and Set_Image work fine, thanks to Gtk.Button.Set_Image.

    for mcc.tki.Widget.Picture.Picture, if i keep
    Gtk.Event_Box.Gtk_Event_Box and I replace Gtk.Pixmap.Gtk_Pixmap by Gtk.Image.Gtk_Image, it seems to be no pb to change the child of the Gtk_Event_Box, but nothing is displayed (including for Create) !

    (on the other case, if I replace Gtk.Event_Box.Gtk_Event_Box by Gtk.Image.Gtk_Image, Create works but Set_Image don't.)



    is it clear enough ?
    do you need to read my code ?
    do you need some test code ?

    --
    RAPID maintainer
    http://savannah.nongnu.org/projects/rapid/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dmitry A. Kazakov@21:1/5 to Thomas on Thu Mar 24 16:47:27 2022
    On 2022-03-24 16:14, Thomas wrote:

    [...]

    is it clear enough ?

    Not really. But anyway it does not work this way. In order to change
    image's pixbuff you must redraw it afterwards and possibly resize it
    etc. It is possible, but you must understand the inner workings of GTK.
    Much simpler is to replace the image widget as a whole.

    If you need a button with image just put an image into it. Gtk_Button is already a container. Put Gtk_Box into it. Put Gtk_Image into Gtk_Box.
    That's would be all.

    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas@21:1/5 to Dmitry A. Kazakov on Thu Mar 24 19:40:39 2022
    In article <t1i3qd$oud$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    On 2022-03-24 16:14, Thomas wrote:

    [...]

    is it clear enough ?

    Not really. But anyway it does not work this way.

    i don't guess what was missing.

    In order to change
    image's pixbuff you must redraw it afterwards and possibly resize it
    etc. It is possible, but you must understand the inner workings of GTK.
    Much simpler is to replace the image widget as a whole.

    ok.
    i think that i need not understand the inner workings of GTK to make
    RAPID, and i don't want it as long as not needed (i still don't
    understand all usages).

    afaiu(nderstand), to make mcc.tki.Widget.Picture.Set_Image working, i absolutely need an intermediate container?

    well, why Gtk_Event_Box is not a good container for a Gtk_Image, while
    it is a good one for a Gtk_Pixmap?


    If you need a button with image just put an image into it. Gtk_Button is already a container.

    yes, it works fine :-)

    Put Gtk_Box into it. Put Gtk_Image into Gtk_Box.
    That's would be all.

    do you mean that (for a simple image, not a button) i should use a
    Gtk_Box as intermediate container, instead of a Gtk_Event_Box?

    --
    RAPID maintainer
    http://savannah.nongnu.org/projects/rapid/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dmitry A. Kazakov@21:1/5 to Thomas on Thu Mar 24 21:33:42 2022
    On 2022-03-24 19:40, Thomas wrote:
    In article <t1i3qd$oud$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    If you need a button with image just put an image into it. Gtk_Button is
    already a container.

    yes, it works fine :-)

    Put Gtk_Box into it. Put Gtk_Image into Gtk_Box.
    That's would be all.

    do you mean that (for a simple image, not a button) i should use a
    Gtk_Box as intermediate container, instead of a Gtk_Event_Box?

    Gtk_Box is handy as you can place many children into it, e.g. labels,
    use alignment etc.

    Gtk_Event_Box is special, it filters events and should be used rarely,
    e.g. with a Gtk_Image or Gtk_Label when you want to turn them into a
    fully functional widgets. You just do not need that because normal
    containers already do the work. If you use Gtk_Event_Box you would have
    to handle necessary signals to make everything work as it would with
    Gtk_Box out of the box (no pun intended).

    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas@21:1/5 to Dmitry A. Kazakov on Fri Mar 25 02:53:00 2022
    In article <t1ikj3$18ak$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    On 2022-03-24 19:40, Thomas wrote:
    In article <t1i3qd$oud$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    If you need a button with image just put an image into it. Gtk_Button is >> already a container.

    yes, it works fine :-)

    Put Gtk_Box into it. Put Gtk_Image into Gtk_Box.
    That's would be all.

    do you mean that (for a simple image, not a button) i should use a
    Gtk_Box as intermediate container, instead of a Gtk_Event_Box?

    Gtk_Box is handy as you can place many children into it, e.g. labels,
    use alignment etc.

    at this step i need not to be able to place many children into it or to
    manage layout,
    because i want to implement this interface, which contains only 2
    procedures - Create and Set_Image:

    http://svn.savannah.gnu.org/viewvc/rapid/branches/gtkada-2.24/src/tki/mcc _tki/mcc-tki-widget-picture.ads?view=markup&pathrev=257
    ( https://urlpetite.fr/olk )


    RAPID is mostly "glue code", but sometimes there is sth to handle :

    for example:
    RAPID interface tells that an image (called a picture label) can have
    its content replaced,
    and Gtk makes it easy for a Gtk_Button containing an image, but not for
    a Gtk_Image.



    normal
    containers already do the work. If you use Gtk_Event_Box you would have
    to handle necessary signals to make everything work as it would with
    Gtk_Box out of the box (no pun intended).

    i would like to be able to use a Gtk_Bin, to access to Gtk.Bin.Get_Child
    which seems to be a lot easier to use than Gtk.Container.Children.


    but first, since you seem to be sure that Gtk_Box is the right container
    to use, i tested it ...
    it doesn't work !

    i don't understand why.

    it is put in a Gtk_Fixed, can that have an influence?

    the case where it works are :
    - Gtk_Pixmap instead of Gtk_Image
    - Gtk_Image without container
    - Gtk_Button set with a Gtk_Image


    any idea of what i should try, now?

    --
    RAPID maintainer
    http://savannah.nongnu.org/projects/rapid/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dmitry A. Kazakov@21:1/5 to Thomas on Fri Mar 25 08:29:03 2022
    On 2022-03-25 02:53, Thomas wrote:

    but first, since you seem to be sure that Gtk_Box is the right container
    to use, i tested it ...
    it doesn't work !

    I am using Gtk_Image in Gtk_Box, it works perfectly well, and worked in
    GTK 2 (I am using GTK 3).

    i don't understand why.

    it is put in a Gtk_Fixed, can that have an influence?

    Gtk_Fixed should never be used, but I doubt it can be the reason.

    the case where it works are :
    - Gtk_Pixmap instead of Gtk_Image
    - Gtk_Image without container
    - Gtk_Button set with a Gtk_Image

    any idea of what i should try, now?

    Do you call Show on the new child widget after replacing it?

    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas@21:1/5 to Dmitry A. Kazakov on Fri Mar 25 20:37:53 2022
    In article <t1jr00$1ja4$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    On 2022-03-25 02:53, Thomas wrote:

    but first, since you seem to be sure that Gtk_Box is the right container
    to use, i tested it ...
    it doesn't work !

    I am using Gtk_Image in Gtk_Box, it works perfectly well, and worked in
    GTK 2 (I am using GTK 3).

    (Gtk_Pixmap were fully removed from GTK 3)


    i don't understand why.

    it is put in a Gtk_Fixed, can that have an influence?

    Gtk_Fixed should never be used, but I doubt it can be the reason.

    i can't do it easily because it would need to review all design an user interface of RAPID.



    the case where it works are :
    - Gtk_Pixmap instead of Gtk_Image
    - Gtk_Image without container
    - Gtk_Button set with a Gtk_Image

    any idea of what i should try, now?

    Do you call Show on the new child widget after replacing it?

    ok, that's it. thank you very much :-))

    afaiu, the specific thing about Gtk_Pixmap is that i need not to call
    Show on it, calling Show on its parent is enough.

    but, I thought calling Show on a container was recursive on its childs,
    wrong?


    last:
    now, it works fine with a Gtk_Event_Box as container.

    is it ok, or do you think i should avoid it anyway?

    if i should avoid it, is there an other Gtk_Bin that i could use, or do
    you think Gtk_Box is the only one i should use for this purpose?

    --
    RAPID maintainer
    http://savannah.nongnu.org/projects/rapid/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dmitry A. Kazakov@21:1/5 to Thomas on Fri Mar 25 21:34:28 2022
    On 2022-03-25 20:37, Thomas wrote:
    In article <t1jr00$1ja4$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    I am using Gtk_Image in Gtk_Box, it works perfectly well, and worked in
    GTK 2 (I am using GTK 3).

    (Gtk_Pixmap were fully removed from GTK 3)

    It is Gdk_Pixbuf now.

    afaiu, the specific thing about Gtk_Pixmap is that i need not to call
    Show on it, calling Show on its parent is enough.

    No, I think that pixmap handles the Draw signal, so you do not need Show because all rendering optimizations are turned off.

    but, I thought calling Show on a container was recursive on its childs, wrong?

    It is recursive, but it affects only actual children. New children are
    hidden by default. I think this is going to change in GTK 4.

    is it ok, or do you think i should avoid it anyway?

    My understanding is that some widgets are optimized not to process
    signals from input devices, e.g. Gtk_Label and Gtk_Image. Because
    normally, you would not use keyboard or mouse buttons on them. But if
    you need that, you add Gtk_Event_Box. If things work without it, then
    leave it as is.

    if i should avoid it, is there an other Gtk_Bin that i could use, or do
    you think Gtk_Box is the only one i should use for this purpose?

    I think any container is OK. I use Gtk_Box just because I want both
    label and icon on the button.

    Gtk_Fixed is bad because it breaks widget resizing protocol. If you
    never resize (e.g. when changing the widget style, fonts, for example)
    then Gtk_Fixed is just fine.

    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas@21:1/5 to Dmitry A. Kazakov on Sat Mar 26 02:38:02 2022
    In article <t1l90i$1otm$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    On 2022-03-25 20:37, Thomas wrote:
    In article <t1jr00$1ja4$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    I am using Gtk_Image in Gtk_Box, it works perfectly well, and worked in
    GTK 2 (I am using GTK 3).

    (Gtk_Pixmap were fully removed from GTK 3)

    It is Gdk_Pixbuf now.

    afaiu, the specific thing about Gtk_Pixmap is that i need not to call
    Show on it, calling Show on its parent is enough.

    No, I think that pixmap handles the Draw signal, so you do not need Show because all rendering optimizations are turned off.

    i don't understand details, but i understand Gtk_Pixmap was badly
    categorized, it is in fact from Gdk familly.
    that's why it has not the same behavior than other Gtk Widgets.


    but, I thought calling Show on a container was recursive on its childs, wrong?

    It is recursive, but it affects only actual children. New children are
    hidden by default. I think this is going to change in GTK 4.

    i understand that about mcc.tki.Widget.Picture.Set_Image.

    but in mcc.tki.Widget.Picture.Create,
    when i call Gtk.Container.Add, and then Gtk.Widget.Show on the
    container, it doesn't work.
    i need to call Gtk.Widget.Show on the image too.

    (no matter if i don't understand, at least that works :-) but if you
    have enough patience, i like understand things :-) )


    is it ok, or do you think i should avoid it anyway?

    My understanding is that some widgets are optimized not to process
    signals from input devices, e.g. Gtk_Label and Gtk_Image. Because
    normally, you would not use keyboard or mouse buttons on them. But if
    you need that, you add Gtk_Event_Box. If things work without it, then
    leave it as is.

    - i need a container anyway,
    - there was already a Gtk_Event_Box around the Gtk_Pixmap when i found
    it,
    - not sure, but i think that RAPID design allows RAPID users to set
    handlers on any Widgets, including Picture.

    so I think it's best to keep Gtk_Event_Box for now.
    thank you for the thinking :-)


    if i should avoid it, is there an other Gtk_Bin that i could use, or do
    you think Gtk_Box is the only one i should use for this purpose?

    I think any container is OK. I use Gtk_Box just because I want both
    label and icon on the button.

    ok, you need it but not me.


    Gtk_Fixed is bad because it breaks widget resizing protocol. If you
    never resize (e.g. when changing the widget style, fonts, for example)
    then Gtk_Fixed is just fine.

    i don't understand details, but i think since RAPID was designed with
    Gtk_Fixed I can keep it without inconvenience in the short term.
    (i plan to make an other design in the medium term.)

    --
    RAPID maintainer
    http://savannah.nongnu.org/projects/rapid/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dmitry A. Kazakov@21:1/5 to Thomas on Sat Mar 26 09:59:08 2022
    On 2022-03-26 02:38, Thomas wrote:
    In article <t1l90i$1otm$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    It is recursive, but it affects only actual children. New children are
    hidden by default. I think this is going to change in GTK 4.

    i understand that about mcc.tki.Widget.Picture.Set_Image.

    but in mcc.tki.Widget.Picture.Create,
    when i call Gtk.Container.Add, and then Gtk.Widget.Show on the
    container, it doesn't work.
    i need to call Gtk.Widget.Show on the image too.

    (no matter if i don't understand, at least that works :-) but if you
    have enough patience, i like understand things :-) )

    Maybe the widgets involved must be "realized" for recursive Show to
    work? The allocation size might be needed correctly set. Maybe the image
    is actually rendered but at a wrong place and size where it is not
    visible. There are many ways to mess it up.

    Gtk_Fixed is bad because it breaks widget resizing protocol. If you
    never resize (e.g. when changing the widget style, fonts, for example)
    then Gtk_Fixed is just fine.

    i don't understand details, but i think since RAPID was designed with Gtk_Fixed I can keep it without inconvenience in the short term.
    (i plan to make an other design in the medium term.)

    RAPID is a GUI generator thing, right? So it tries to manage the layout
    by itself instead of using the prescribed techniques. Then Gtk_Fixed is
    a way to go.

    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas@21:1/5 to Dmitry A. Kazakov on Sat Mar 26 18:32:50 2022
    In article <t1mkkt$1vs3$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    On 2022-03-26 02:38, Thomas wrote:
    In article <t1l90i$1otm$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    It is recursive, but it affects only actual children. New children are
    hidden by default. I think this is going to change in GTK 4.

    i understand that about mcc.tki.Widget.Picture.Set_Image.

    but in mcc.tki.Widget.Picture.Create,
    when i call Gtk.Container.Add, and then Gtk.Widget.Show on the
    container, it doesn't work.
    i need to call Gtk.Widget.Show on the image too.

    (no matter if i don't understand, at least that works :-) but if you
    have enough patience, i like understand things :-) )

    Maybe the widgets involved must be "realized" for recursive Show to
    work? The allocation size might be needed correctly set.

    (not sure to understand)

    Maybe the image
    is actually rendered but at a wrong place and size where it is not
    visible.

    (i think that's not possible)

    There are many ways to mess it up.

    i don't succeed in finding an order where calling Gtk.Image.Show is not
    needed.
    (of course all with Gtk.Container.Add before Gtk.Widget.Show on the
    container, although i found it the other way)

    i don't understand what's wrong. no matter.


    i'm stupid, there was a call to Gtk.Pixmap.Show that i didn't see when i removed it. (sorry!)

    since it can be made before call to Gtk.Container.Add, that raises a new question:

    should i prefer to call Gtk.Image.Show as soon as possible, when
    creating mcc.tki.Image.External_Image?
    or should i call Gtk.Image.Show only at the time it is really displayed,
    when creating mcc.tki.Widget.Picture.Picture?




    Gtk_Fixed is bad because it breaks widget resizing protocol. If you
    never resize (e.g. when changing the widget style, fonts, for example)
    then Gtk_Fixed is just fine.

    i don't understand details, but i think since RAPID was designed with Gtk_Fixed I can keep it without inconvenience in the short term.
    (i plan to make an other design in the medium term.)

    RAPID is a GUI generator thing, right?

    right :-)
    http://www.nongnu.org/rapid/docs/rapid_novice_mode_tutorial.html

    So it tries to manage the layout
    by itself instead of using the prescribed techniques. Then Gtk_Fixed is
    a way to go.

    it asks the user to choose the position and size of each widget, instead
    of ask him to make stacks with automatic layout management, like Gtk
    does with Gtk_Box.

    --
    RAPID maintainer
    http://savannah.nongnu.org/projects/rapid/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dmitry A. Kazakov@21:1/5 to Thomas on Sun Mar 27 11:33:14 2022
    On 2022-03-26 18:32, Thomas wrote:
    In article <t1mkkt$1vs3$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    since it can be made before call to Gtk.Container.Add, that raises a new question:

    should i prefer to call Gtk.Image.Show as soon as possible, when
    creating mcc.tki.Image.External_Image?
    or should i call Gtk.Image.Show only at the time it is really displayed,
    when creating mcc.tki.Widget.Picture.Picture?

    I usually create new widgets derived from a container, more or less
    always. GtkAda allows this nicely. Then in my implementation of
    Initialize for the custom I call Show at its end. I never had issues
    with this approach.

    So it tries to manage the layout
    by itself instead of using the prescribed techniques. Then Gtk_Fixed is
    a way to go.

    it asks the user to choose the position and size of each widget, instead
    of ask him to make stacks with automatic layout management, like Gtk
    does with Gtk_Box.

    Yes, using GTK in a totally non-GTK way. I had this problem designing my GTK/Cairo-based library for instruments like meters, gauges etc. I used relative positions and sizes instead of fixed ones to support resizing
    the top-level dashboard widgets. Plus hacks for keeping or not keeping
    aspect ratio of the resized thing. The base is Gtk_Drawing_Area_Record
    rather than Gtk_Fixed_Record.

    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas@21:1/5 to Dmitry A. Kazakov on Sun Mar 27 18:41:58 2022
    In article <t1pb0r$elh$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    On 2022-03-26 18:32, Thomas wrote:

    should i prefer to call Gtk.Image.Show as soon as possible, when
    creating mcc.tki.Image.External_Image?
    or should i call Gtk.Image.Show only at the time it is really displayed, when creating mcc.tki.Widget.Picture.Picture?

    I usually create new widgets derived from a container, more or less
    always. GtkAda allows this nicely. Then in my implementation of
    Initialize for the custom I call Show at its end. I never had issues
    with this approach.

    it doesn't help me. no matter. I made a choice :-)



    it asks the user to choose the position and size of each widget, instead
    of ask him to make stacks with automatic layout management, like Gtk
    does with Gtk_Box.

    Yes, using GTK in a totally non-GTK way.

    :-)

    I had this problem designing my
    GTK/Cairo-based library for instruments like meters, gauges etc. I used relative positions and sizes instead of fixed ones to support resizing
    the top-level dashboard widgets. Plus hacks for keeping or not keeping
    aspect ratio of the resized thing. The base is Gtk_Drawing_Area_Record
    rather than Gtk_Fixed_Record.

    i don't think it's pertinent to apply full flexibility to all widgets,
    but :

    as is, i get 2 differents behaviors :

    - with Tcl/Tk, the window can be fully resized, the overflowing widgets
    are hidden, and still shown when the window is enlarged.

    - with GTK, the window cannot be fully resized, it is forbidden to hide
    any widget set in the Gtk_Fixed.


    any opinion ?

    --
    RAPID maintainer
    http://savannah.nongnu.org/projects/rapid/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dmitry A. Kazakov@21:1/5 to Thomas on Sun Mar 27 19:34:15 2022
    On 2022-03-27 18:41, Thomas wrote:

    i don't think it's pertinent to apply full flexibility to all widgets,
    but :

    as is, i get 2 differents behaviors :

    - with Tcl/Tk, the window can be fully resized, the overflowing widgets
    are hidden, and still shown when the window is enlarged.

    This is of course unacceptable behavior.

    In GTK if you want this you simply disable shrinking, expanding,
    filling, that would produce this kind of mess.

    The proper approach in case you do not want to resize children is to use Gtk_Scrolled_Window as the top-level container.

    [ Without scroll bars it will silently clip, achieving the best
    masochistic user satisfaction... (:-)) ]

    - with GTK, the window cannot be fully resized, it is forbidden to hide
    any widget set in the Gtk_Fixed.

    You can always catch size allocation signals and hide widgets you wanted.

    [ GTK 3 changed the protocol a bit from one in GTK 2, they added
    preferable widget sizes, but in essence these details are irrelevant for Gtk_Fixed. ]

    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas@21:1/5 to Dmitry A. Kazakov on Wed Mar 30 04:58:33 2022
    In article <t1q76m$c44$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    On 2022-03-27 18:41, Thomas wrote:

    i don't think it's pertinent to apply full flexibility to all widgets,
    but :

    as is, i get 2 differents behaviors :

    - with Tcl/Tk, the window can be fully resized, the overflowing widgets
    are hidden, and still shown when the window is enlarged.

    This is of course unacceptable behavior.

    when i'll review windows, i hope Simon Wright will be available to help
    me ;-) i don't know tcl at all !


    - with GTK, the window cannot be fully resized, it is forbidden to hide
    any widget set in the Gtk_Fixed.

    The proper approach in case you do not want to resize children is to use Gtk_Scrolled_Window as the top-level container.

    yes,
    when i'll review windows, i'll do that.

    (afaiu, i need to put a Gtk_Viewport in a Gtk_Scrolled_Window ?
    a Gtk_Window doesn't do the job ?)



    You can always catch size allocation signals and hide widgets you wanted.

    it would need to improve the user interface.

    --
    RAPID maintainer
    http://savannah.nongnu.org/projects/rapid/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dmitry A. Kazakov@21:1/5 to Thomas on Wed Mar 30 14:46:12 2022
    On 2022-03-30 04:58, Thomas wrote:

    (afaiu, i need to put a Gtk_Viewport in a Gtk_Scrolled_Window ?
    a Gtk_Window doesn't do the job ?)

    I don't remember GTK 2 well. In GTK 3 you can just set policy of a Gtk_Scrolled_Window to add/remove scroll bars automatically as necessary.

    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)