Hi

You can't do that without implementing your own widget because of
thread-safety issues. To do your own
GtkFlowBox implement GtkWidget:size-allocate and
GtkWidget:size-request the rest is up to you.

Don't forget doing mutices or use g_timeout_add() but this is single
threaded and is invoked by
g_main_context_iteration().

For a simple example consider this:

http://git.savannah.gnu.org/cgit/gsequencer.git/tree/ags/X/editor/ags_notebook.c?h=0.7.x#n167

It is a scrolled window containing buttons doing a scrollable area.

You have to use gdk_threads_enter() and gdk_threads_leave(). Might be
you have even to acquire
the GMainContext.

Bests,
Joël



On Mon, Sep 12, 2016 at 5:03 PM, Gergely Polonkai <gerg...@polonkai.eu> wrote:
> Hello,
>
> I have no knowledge of Java/Swing, but based on your requirements I guess
> you need FlowBox[1].
>
> Best,
> Gergely
>
> [1] https://developer.gnome.org/gtk3/stable/GtkFlowBox.html
>
> On Mon, Sep 12, 2016, 16:35 Daniel. <danielhi...@gmail.com> wrote:
>
>> Hi everybody,
>>
>> I have a library implementing some protocol. That library is
>> multithread and is responsible to delivery messages to remote nodes
>> and retrieve it's responses. I need to visualise the whole mess
>> running.
>>
>> To do this I wrote a simple application in Java/Swing where for each
>> remote node one thread is created. The thread will send a message and
>> wait for response in a closed loop. Each thread is represented at GUI
>> by a label on the screen. When it's idle the background of that label
>> becomes green, when is waiting for response it is yellow and if
>> timeouts it becomes red. All labels have the same information so that
>> they have exactly the same size.
>>
>> Beside the request/repsonse there is events that can arrive from the
>> nodes too. That events need to be replied as the messages. When an
>> event arrives it's showed up on screen as a new label. When it's reply
>> is acknowledge it's removed from the screen.
>>
>> In pratice there is a big container where the labels came and go and
>> change its background colors based on messages, replies and events
>> comming and going.
>>
>> I've been using FlowLayout as the "big container". The labels are
>> added and arrange horizontally by FlowLayout. When no room is avaible
>> at the current row, a new row is added. When the rows exceed the
>> window size a scrowbar appears.
>>
>> I'm looking for something silimar with GTK2 (I'll run in a embeeded
>> system that doesn't have GTK3).
>>
>> My questions are:
>>
>> 1) Is there some container with equivalent behavior to the Swing's
>> FlowLayout? If no I think I'll need to build one from hbox+vbox, what
>> would be the best aproach to it.
>> 2) How is the best way to change the background of a label?
>> 3) What is the better aproach when adding instantiating, adding,
>> showing, hiding removing and freeing widgets at runtime? What can get
>> wrong?
>>
>> References:
>> https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html#flow
>>
>> Best regards,
>> --
>> "Do or do not. There is no try"
>>   Yoda Master
>> _______________________________________________
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to