Re: What is the minimum number of lines to update a gui window without user clicking a button
HelloWorld::HelloWorld() : m_textview() { add(m_textview); m_textview.show(); Glib::Thread::create(sigc::mem_fun(*this, HelloWorld::cpp_app), true); } [...] void HelloWorld::cpp_app() { string texttoprint = ; Glib::RefPtrGtk::TextBuffer m_refTextBuffer; m_refTextBuffer = Gtk::TextBuffer::create(); string runit(std::string c); texttoprint += About to run a number of c++ functions\nand display the results\n; m_refTextBuffer-set_text(texttoprint); m_textview.set_buffer(m_refTextBuffer); sleep(10); // This sleep function represents any c++ function performaing a task I would like to clarify implementation details a bit more from this programming attempt. Can it be that the referenced text buffer is written in a thread-unsafe way here? How do think about to apply improved techniques and software ingredients like locks for memory consistency? (Andrew Potter and Gavin Lambert suggested also an alternative program structure. - https://mail.gnome.org/archives/gtkmm-list/2013-August/msg00135.html ) Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: What is the minimum number of lines to update a gui window without user clicking a button
I'm sure I can add a lot of highlights and decorations now. But I can't emphasis how important I consider having the rawest and most basic (blank) slate to begin with. The absolute only thing that matters at this point is for me to actually be able to have a gui window and update it with appended or new text. Are you also interested to write any message to a file? How do you think about to deal with documents? http://bakery.sourceforge.net/ Would you like to scroll through the logs? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: What is the minimum number of lines to update a gui window without user clicking a button
The only difference is Alan's submission uses the label widget and the one you're quoting above uses textview. I could be wrong and you might see something else subtle that I'm missing. Do you understand the involved consequences from the software technique multi-threading? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: What is the minimum number of lines to update a gui window without user clicking a button
But after getting the label widget changed to a textview widget and having the code actually work, the task was done. I got the impression that there are still some open issues remaining. It's common for a new user to an environment to want to see something very clear... to print a HelloWorld as a starting reference. That is fine, of course. Many people might not have problems if the HelloWorld included file IO, scroll locks, window decorations, and more. You can choose from which abstraction level and tool box the experiments should start. I try to point out not to reinvent a coding wheel. That's the way it works in my case. You might be a beginner with GTK+ functions and classes while you evolved to an advanced or even expert software developer in other areas through the years eventually. I hope that you enjoy the next technical challenges. Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: What is the minimum number of lines to update a gui window without user clicking a button
There aren't any significantly open issues. The code presented by Alan works perfectly. Would you like to show a specific source code version which was accepted for your execution environment? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: What is the minimum number of lines to update a gui window without user clicking a button
Do you see any technical problems with what I posted? Eventually, yes. It depends on the observed execution speed in your application for example. When would you categorise the situation that a specific graphical user interface becomes unresponsive? Do you expect visual feedback in less than a second for your programs? Do you think you could make it more efficient? There are more aspects to consider besides efficiency. How do you think about to apply the design pattern Model-View-Controller? http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller Then, instead of writing three lines to update the gui window, I'd be able to type: gprint(Updated text); Such a desire is fine until you clarify a few more implementation details. Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: What is the minimum number of lines to update a gui window without user clicking a button
As far as you seeing a technical problem, is it possible that you could post some code that would actually work to identify the problem? Your function HelloWorld::cpp_app indicated in this example that it will execute for some seconds. I got doubts that the graphical user interface will be as responsive as you might expect it. A well-known approach is to perform long lasting data processing in a dedicated thread which is separate from the one which serves the user interface. You need to be very careful with synchronisation so that you avoid thread-unsafe data accesses. http://en.wikipedia.org/wiki/Synchronization_%28computer_science%29 I can't say I fully understand it. Do you like a different description about GUI architectures? http://martinfowler.com/eaaDev/uiArchs.html Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: What is the minimum number of lines to update a gui window without user clicking a button
I'm studying in detail the links that you're providing, but I can't see from those links what specific I should change and still have the code function as desired. I'm curious when you start playing around with software design extensions for your small program example. ;-) Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: What is the minimum number of lines to update a gui window without user clicking a button
I don't know what you mean by design extensions. I find that strange to some degree ... But I started out programming in assmebly language in the Late 70's. I went to C in the early 80's. It was all in DOS, not Windows. In the late 90's I started using a semi graphical interface by programming perl CGI. I also started using Visual C++ and the MFC environment around that time. I assume that you are used to the selection and application of design patterns if you mention such a long software development experience. http://en.wikipedia.org/wiki/Software_design_pattern Most of the times when I ask a client to read to me what they see, when they see a black screen, they say they don't see anything. It takes a while for them to realize the black screen has usable information. How do you think about any fine-tuning for text colours in your log console? Might a Curses-based user interface also be sufficient for your use case? http://en.wikipedia.org/wiki/Curses_%28programming_library%29 Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: What is the minimum number of lines to update a gui window without user clicking a button
You're right about my desire to log text in a gui window. I don't want a list box or control widgets in this particular case. As far as sophisticate widgets, I don't want any widgets at all. There might still be a few more technical details which you would like to consider for your log viewer implementation. If there's something wrong with my example, I appreciate any comments or suggestions. But if someone says it wrong and use programming terms that I don't fully understand, it's not much I can do with it as far as change and actually have it continue to perform the desired task (update the gui window after running a function). How do you think about a message display in several log windows from one application in parallel? How do you keep the graphical user interface responsive during this output? http://c2.com/cgi/wiki?EventDrivenProgramming Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: What is the minimum number of lines to update a gui window without user clicking a button
You are telling me to do it a different way and at the same time telling me how complicated it is. Without examples of the different way, I don't know where to start. I guess that you want to become familiar with a general program structure together with the GTK+ software. I assume that you want to display some text in a log window for your use case. Would you like to reuse a list box or table control? (Do you need any other higher sophisticated widget?) How fast do you get the needed data for the desired output? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: How to forward accesses from model attributes to other class attributes?
Can read/write accesses be forwarded from a model column to a different attribute? Do any more software developers fiddle with such implementation details? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: How to forward accesses from model attributes to other class attributes?
Can read/write accesses be forwarded from a model column to a different attribute? Can an access to a model attribute be intercepted at all? How do you redirect a read/write request to a different target? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: How to forward accesses from model attributes to other class attributes?
Can read/write accesses be forwarded from a model column to a different attribute? Can a column act as a proxy for an other item? How do you think about the use of a Gtk::...ModelColumn that can be initialised with a reference to the passed template type by a constructor variant? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: How to forward accesses from model attributes to other class attributes
Can read/write accesses be forwarded from a model column to a different attribute? How do you think about the use of a Gtk::...ModelColumn that can be initialised with a reference to the passed template type by a constructor variant? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Clarification for the application of GVariant/Glib::Variant maybe types
Does it support to reset such a C++ variable to an instance which will be marked as nothing? No. Would you like to add this capability to your class Glib::Variant? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Application of preconditions for status transitions from data input in views
I am still looking for an easier coordination of input/model validation. Do you know any higher level framework for this purpose? No. Is it possible to intercept write accesses to model attributes (Gtk::TreeModel::ColumnRecord ⇒ Gtk::TreeModelColumn)? How are the chances to integrate validation rules into the gtkmm software infrastructure? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Application of preconditions for status transitions from data input in views
Hello! The documentation for the member function append_column_editable provides the following information. http://developer.gnome.org/gtkmm/3.2/classGtk_1_1TreeView.html#a83d537226054aa792c03248e619f Appends a View column with the appropriate CellRenderer for the Model column. The compiler will attempt to instantiate appropriate template code to automatically store user changes in the model. To intercept the user's change and implement non-default logic, or if the compiler can't instantiate appropriate code for your model type, you could use append_column() and connect a signal handler to the CellRenderer. Now I have got an use case where I appreciate some effects from this automatic setting. But I would like to apply input validation before model attributes will be actually changed. I imagine that I need something from the model software infrastructure to intercept a write request to an attribute so that it will become possible for an enquiry in the (graphical) user interface if the desired change will need additional information. How do you get the corresponding view to display a required confirmation dialogue? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Mapping of model attributes with unknown values to a corresponding widget display
You can connect model columns to cell renderer properties using add_attribute like so: http://developer.gnome.org/gtkmm-tutorial/unstable/sec-treeview.html.en#treeview-cellrenderer-details Thanks for your link. So something like this should work: viewcolumn-add_attribute(renderer-property_inconsistent(), m_columns.m_inconsistent); Can such a connection also be specified for a context-sensitive predicate function? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Application of preconditions for status transitions from data input in views
This example shows how you might do validation before accepting the value: http://developer.gnome.org/gtkmm-tutorial/unstable/sec-treeview-examples.html.en#sec-editable-cells-example The section Implementing custom logic for editable cells points also to a few implementation details. http://developer.gnome.org/gtkmm-tutorial/stable/sec-treeview.html#treeview-editable-cells-custom I am still looking for an easier coordination of input/model validation. Do you know any higher level framework for this purpose? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Clarification for the application of GVariant/Glib::Variant maybe types
Note that GVariant generally doesn't have set functions. It's meant to be an invariant type. This C API corresponds to the immutable object interface category then. That probably makes it unsuitable for general use anyway. I guess that your class Glib::Variant makes it more convenient to work with them. Does it support to reset such a C++ variable to an instance which will be marked as nothing? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
How to forward accesses from model attributes to other class attributes
Hello! I have got the impression that model attributes like a Gtk::TreeModelColumn store their information completely themselves so far. http://developer.gnome.org/gtkmm/3.2/classGtk_1_1TreeModelColumn.html Some models contain also additional class attributes (with reusable details) that do not provide a model column interface. Now I am looking for an adapter which supports efficient data exchange. (I hope that unneeded data copying can be avoided with a direct connection from the data source to the target column by an appropriate model adapter.) Can read/write accesses be forwarded from a model column to a different attribute? http://en.wikipedia.org/wiki/Adapter_pattern How do you think about opportunities for improvements in the gtkmm template class library? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
How to connect editable check boxes from a tree view with the corresponding data row?
Hello! I have reused standard check boxes in a tree view column by the member function append_column_editable. Now I find that two implementation details are not clear enough for me yet. 1. How do I get to an object from this addition so that the function ...-signal_toggled().connect(sigc::mem_fun(*this, my_tree_view::on_toggled)) can be called? 2. How do I get the connection back in the triggered callback function to the affected data row for which a check button was clicked? How can be ensured that corresponding changes will be stored back in the appropriate model record set for my table view? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Clarification for the application of GVariant/Glib::Variant maybe types
I'm merely thinking about how it could be added to the API. I am also curious how such an addition will look like. http://developer.gnome.org/glib/2.30/gvariant-text.html#gvariant-text-maybe-types Will this functionality be mapped to nullable value object containers? http://developer.gnome.org/glibmm/2.30/classGlib_1_1VariantContainerBase.html I imagine that the following functions will be useful. - g_variant_is_maybe - g_variant_can_be_maybe - g_variant_convert_to_maybe (interface alternative for g_variant_get_maybe) - g_variant_set_to_nothing How would they be integrated into your (template) class library? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Clarification for the application of GVariant/Glib::Variant maybe types
The description of the GVariantType has a little more explanation: http://developer.gnome.org/glib/stable/glib-GVariantType.html#glib-GVariantType.description Thanks for this link. - I'm sorry that I did not find the following paragraph earlier. The first major change with respect to the D-Bus type system is the introduction of maybe (or nullable) types. Any type in GVariant can be converted to a maybe type, in which case, nothing (or null) becomes a valid value. Maybe types have been added by introducing the character m to type strings. By which (member) function can such a variable be marked to contain an unknown value? (Do I overlook a programming interface once more?) http://developer.gnome.org/glibmm/2.30/classGlib_1_1VariantBase.html Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Support for column/row grouping
A Gtk::TreeModel can contain just about any copyable type via the Gtk::TreeModel::Column template. You'd have to try. You can use the cell_data_func() to set the inconsistent property. I don't personally believe that the Gtk::CellRenderToggle's inconsistent property will be used often enough to justify introducing a new 3-value type and a Gtk::TreeView::append_column() convenience method that uses it. I find that this part of your answer belongs more to the discussion around topics like Mapping of model attributes with unknown values to a corresponding widget display, doesn't it? ;-) Different issue: How do you think about improvements for the grouping of row/column headers? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Animated status bar icon
I like to create an animated statusbar icon like this: Did you start this topic as a reply to my different issue inadvertently? Would you like to contribute anything to the discussion model attributes with unknown values? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Support for column/row grouping
This might be possible by using the Gtk::CellLayout interface of Gtk::TreeViewColumn, I don't know for sure. Can anything be reused for row/column groups with gtkmm means from other class libraries? Examples: http://www.w3.org/TR/html4/struct/tables.html#h-11.2.4 https://developer.mozilla.org/en/DOM/HTMLTableColElement http://eclipse.org/nebula/widgets/grid/grid.php https://bugs.kde.org/show_bug.cgi?id=144376 Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Mapping of model attributes with unknown values to a corresponding widget display
The VariantContainerBase class contains other variants. It can contain what is called a maybe type which is one that may be null (see Glib::VariantType::create_maybe()[1]). As I said, though, it may not be useful for your purposes. I find the applicability of a maybe still unclear. Are there any more explanations for this data type available? Do useful method overloads exist for a safe cooperation with the GUI? By the way: I would still prefer a template class for nullable types over a Variant style interface. Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Support for nullable data types (by a template class?)
http://en.wikipedia.org/wiki/Nullable_type Was this kind of programming interface already discussed for its use besides the data base abstraction library for GNOME (libgda)? How would you like to represent an unknown or intermediate value status? Other implementation examples: http://pocoproject.org/docs/Poco.Nullable.html http://www.codeproject.com/KB/mcpp/CNullable.aspx http://nullabletypes.sourceforge.net/sqltypes.html http://www.boost.org/doc/libs/1_47_0/doc/html/boost/logic/indeterminate.html Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Mapping of model attributes with unknown values to a corresponding widget display
Obviously C++'s bool type can't represent 3 values. You would need something else, I suppose. Would it make sense to convert a class like boost::logic::tribool into a gtkmm component? http://www.boost.org/doc/libs/1_47_0/doc/html/tribool/tutorial.html Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Support for flexible labels under place constraints
No, though I don't see why it would not be possible. I would like to describe my use case from another perspective. Now I am looking for a reusable widget which deals with requirements like the following. - Ideogram It can be implemented as an icon (raster image/vector graphic) or as an Unicode character (with eventually a special font). - Text with varying length (abbreviation, short or full label) - The display should adapt to the available visual space like it is provided by a row/column header. The more space will be reduced (to an useful minimum height/width) the widget should only attempt to display the label part which still fits. The user can choose if there is a personal preference for the ideogram in combination with the textual description. - Both data components should belong to a common translation unit. Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Mapping of model attributes with unknown values to a corresponding widget display
That method's documentation mentions that you can instead create the TreeView::Column manually and use TreeViewColumn::set_cell_data_func() with your own callback slot, which you could use to set the inconsistent property: http://developer.gnome.org/gtkmm/unstable/classGtk_1_1CellRendererToggle.html#a680f8f0b502d82a6c909aafe90284026 I hope that a related method overload exists already in a convenience library. How do you store a NULL (SQL) for a model attribute with a data type like bool and update its visual appearance accordingly? Obviously C++'s bool type can't represent 3 values. You would need something else, I suppose. I know that, too ... - I'm just looking for general programming interfaces which make the handling of model attributes with unknown values a bit more convenient. Personally, I use Gnome::Gda::Value, from libgda, via libgdamm. It's not wonderful, but it works. I find the documentation for this class incomplete. http://developer.gnome.org/libgdamm/4.99/classGnome_1_1Gda_1_1Value.html Can such a class be used without the complete database abstraction library? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Mapping of model attributes with unknown values to a corresponding widget display
I don't really know what you are asking for. I hope that I can clarify my imaginations a bit more for a better common understanding. Can such a class be used without the complete database abstraction library? Yes, if you write it yourself, or accept the LGPL license. I hope that something can be reused from the handling of nullable data types without access to a (relational) data base library. http://en.wikipedia.org/wiki/Nullable_type If I would like to raise the abstraction level a bit for the fields of a simple data structure like an array, I do not want to develop a corresponding kind of ODBC driver. http://developer.gnome.org/libgda/4.2/features.html I'm looking for general programming interfaces which allow me the signalling of unknown values to targets like a GUI in a consistent way. Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Mapping of model attributes with unknown values to a corresponding widget display
Hello! The class Gtk::CheckButton provides the feature to display an intermediate status (by the interface gtk_toggle_button_set_inconsistent), doesn't it? http://developer.gnome.org/gtk3/3.2/GtkToggleButton.html#gtk-toggle-button-set-inconsistent http://developer.gnome.org/gtkmm/3.2/classGtk_1_1CheckButton.html#_details I would like to know the recommend way to represent unknown values for model attributes when it seems that a member function like Gtk::TreeView::append_column does not support the use of three-valued logic directly. http://developer.gnome.org/gtkmm/3.2/classGtk_1_1TreeView.html#a0253a5477ce006bf84fae8eb205efc73 http://en.wikipedia.org/wiki/Three-valued_logic#Representation_of_values How do you store a NULL (SQL) for a model attribute with a data type like bool and update its visual appearance accordingly? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Support of flexible label for narrow column header
By using Gtk::TreeViewColumn::set_widget() on the column of the TreeView, it should be possible to display mostly anything that an application can display. This member function sounds interesting. http://developer.gnome.org/gtkmm/3.2/classGtk_1_1TreeViewColumn.html#a3b8c4e3b7e8b579090440c50843efd26 Do you know any approach which combines it with the function Gtk::TreeView::append_column directly? Have you heard about reusable base classes which will provide desired adjustments for column header labels by a safe interface? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Support of flexible label for narrow column header
Hello, Member functions like Gtk::TreeView::append_column provide the feature to add a column to a specific view. http://developer.gnome.org/gtkmm/3.2/classGtk_1_1TreeView.html#a0253a5477ce006bf84fae8eb205efc73 They get a Glib::ustring as a parameter. I find that the width of corresponding labels will become too big for some displayed values like small numbers or from a boolean data type. Now I am looking for ways to adjust the column header depending on width constraints. Is a switch possible for the display of items like the following in the header? - raster image - vector graphic - text with varying length (abbreviation, short or full label) Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Support for column/row grouping
Hello! The example http://www.sencha.com/examples/pages/grid/columngrouping.html; shows an application feature I'm also interested in for table widgets. Does a similar gtkmm extension exist which supports the hierarchical grouping of columns and/or rows like it is demonstrated by a framework for the Google Web Toolkit? Regards, Markus ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list