1

I'm developing an application - written in rust, that registers items in a database, but I'm having trouble showing the data in a way that is visually good, I tried to use the Browser widget but it's not visually appealing. I have a struct Items that store name, quantity and price, and a vector of Items that stores the field values, how can I show the items stored in the database, and what is the best widget to do that?

  • What is the "product" ? – DejanLekic Aug 21 '22 at 20:16
  • Sorry, its a vector of type Items - a struct, with name, quantity and price, i'm trying to display it, but cant find a good way to do it. –  Aug 21 '22 at 20:27
  • What did you try so far? Do you want to just show all these information or do you have to allow the user to process them too (sort them per price, find the item with max price, ...)? – Eddymage Aug 22 '22 at 07:18
  • I suggest to ask FLTK related questions in the official user forum fltk.general at https://groups.google.com/g/fltkgeneral . There are lots of possibilities to create your own layout, you need to provide more information. How many items do you need to display, how much data per item, etc. etc. If there are many items you'd probably use an Fl_Scroll widget to put all your items into, but the structure of each item can really be different. You can even subclass Fl_Browser_ (trailing '_') to make your own text display per item. And more... – Albrecht Schlosser Aug 22 '22 at 19:34

1 Answers1

1

Natural choice would be to use the Fl_Table and Fl_Table_Row classes in your project.

Greg Ercolano has an example how to use them at https://www.seriss.com/people/erco/fltk/Fl_Table/ . In fact, he is the original author of these classes, later on they got into the FLTK itself...

Do not be confused with the screenshot when you see those buttons inside the table. - He just wanted to demonstrate that you can put any Widget in Fl_Table cells.

DejanLekic
  • 18,787
  • 4
  • 46
  • 77
  • Thanks, it's exactly what I needed, i'm new to stackoverflow, theres an option to mark my question as answered ? –  Aug 22 '22 at 14:30
  • You mark my answer as the correct one, and then your question will have 1 (accepted) answer. – DejanLekic Aug 22 '22 at 14:42
  • 1
    Done, its the icon under the vote options, rigth? –  Aug 22 '22 at 14:45