GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Mon Nov 24, 2014 7:58 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: matrix input
PostPosted: Sun Apr 15, 2012 6:15 pm 
Offline
Familiar Face

Joined: Sat Apr 14, 2012 5:42 pm
Posts: 6
Hi gtk team!
I am new to this forum and this is my first post...
What is the best way to handle a 3*3 matrix input from a user.

The wanted matrix (a deformation gradient) is always symetric so the input shoud reduce to 6 entrys.
It would also be good if the numbers are written simultaneously into the matrix.
If one matrix is filled out it should be shown and by proceeding entering the next values a new matrix should start.
The user should also be asked at first how many matrices he wants to enter.

i am thankful for any help!


Top
 Profile  
 
 Post subject: Re: matrix input
PostPosted: Tue Apr 17, 2012 5:27 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
As your dealing with numeric data you would most likely want spin buttons rather than entries.

Pack all nine of them into a GtkTable (see the tutorial at http://zetcode.com/tutorials/gtktutorial/gtklayoutmanagement/)
If you use the same GtkAdjustment for the diagonally adjacent buttons then updating one will automatically update the other.

What you suggest about adding a new matrix when the user finishes can have things go wrong if the user enters something incorrectly and wants to change it later. It would be good to have another spinner that sets the number of matrices or an add/delete button (as well as potentially the option of reshuffling them in the queue if ordering matters). Gtk has some flexible data types such as GArray and GSList that can expand arbitrarily after their defined. Pack in the adjustments and you can retrieve the data later and reuse the variable names.

Matrices can occupy a lot of screen space and once they're entered they probably don't need to be shown in full. If you stick them in a GtkExpander then the user can access them any time and hide them when done.


Top
 Profile  
 
 Post subject: Re: matrix input
PostPosted: Tue Apr 17, 2012 11:49 am 
Offline
Familiar Face

Joined: Sat Apr 14, 2012 5:42 pm
Posts: 6
thanks a lot so far


Top
 Profile  
 
 Post subject: Re: matrix input
PostPosted: Thu Sep 06, 2012 12:57 pm 
Offline
Familiar Face

Joined: Sat Apr 14, 2012 5:42 pm
Posts: 6
ok so i use spin buttons for my numerics and a table...
how do i get the user to write an value in it?
sry i am really new to this
thanks in advance...


Top
 Profile  
 
 Post subject: Re: matrix input
PostPosted: Thu Sep 06, 2012 4:29 pm 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 177
Location: USA
You haven't provided hardly any information here. We don't know what programming language your using, what version or revision of GTK your using or your O.S. Please read my permanent post:
http://www.gtkforums.com/viewtopic.php?f=3&t=178057

Also unless your using Gtk+2 I would not use GtkTable, it's been de-predicated. Use GtkGrid instead.
There's official GTK documentation to help you make the switch from other container widgets to GtkGrid.
http://developer.gnome.org/gtk3/stable/gtk-migrating-GtkGrid.html


Top
 Profile  
 
 Post subject: Re: matrix input
PostPosted: Fri Sep 07, 2012 12:13 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
The GtkSpinButtons have both a spinner and text entry so your user should be able to enter in numbers with the keyboard. Have a look at the gtkadjustment documentation: http://developer.gnome.org/gtk/2.24/GtkAdjustment.html.
Zerohour's right about the gtk version. GtkTable is depreciated in v3 and GtkGrid has been declared the way of the future. At the moment things are in transition and devs are best keeping both in mind. I must object about the programming language as nothing you have asked and nothing I've given as an answer has been language specific and keeping things as generic as possible will help more people. It won't hurt to mention. I normally assume c; being more universal and convertible into other languages.
btw for keyboard accessibility a user will usually tab between entries. As your matrix is symmetric you may want to only allow the upper triangle to have focus in which case you should use something like gtk_widget_set_can_focus to disable the other spinners. If your making a lot of these matrices and are more object oriented you may want to declare your own class using GObject.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group