Adding fields to records from a Listbox

In FileMaker it’s very easy to connect fields to a record, but how do I do this in xojo?

On my Layout I have a Listbox and a text field, both have a table and correspond fields in the database file.

How do I connect the text field to the Listbox so that when selecting another row in the Listbox, the Text field will show the correct info?

I know this must be very basic so a pointer in the right direction would be of great help. If i know how to do this, most of my application will be working already.

take a look at the EddieElectronics example in the xojo folders.
everything to start a small database is here.
but be aware that replacing filemaker with xojo involves a big time in databases kernel methods.
some guys here made some ready made modules for that :
just thinking to https://www.bkeeney.com/allproducts/argen/
there are others like pidog dataview.
I made my own some years ago now.

Thanks. I don’t want to replace the FileMaker project or database so I can use it in xojo. I want to learn how to build the same program again but now in xojo.

What have you done, so far, in Xojo ?

Here are some (more) useful links:

http://documentation.xojo.com/index.php?search=SQLite+Basics

this gives you a lot of links. Start with: http://documentation.xojo.com/topics/databases/supported_engines/sqlite/sqlite_basics.html
BTW: forget the references to the embedded DB editor.

You ahve to decide what king of View you will do (or both):
a window with record View (with all fields for One Record at a Time)
a window with a list view (a ListBox) who will display all data from all Records at once.

The way to get the data is similar, but the destination is different: in the former case, you will have a bunch of TextFields (and maybe other Controls) on the window and in the former, only a ListBox is needed.

That recalls FileMaker…

Then, ask here when needed.

i would start subclass this Listbox and Textfield so you can add own functionality and properties. see contextmenu new subclass.
in the ui designer you can change the super to your new subclass name.
you can register Events with AddHandler or use some kind of dependency injection.
own Events you can create with Menu Add Event Definition.

I have set up a basic layout for the program I am hoping to create. After that I went through the basic Desktop (taks list etc) courses and watched the Introduction to programming 1 and 2 a couple of times and followed it in Xojo. I also watched some random videos like Using the Listbox and Using SQLite in Xojo apps. I am catching on little by little.

I am going for a window with a list view (a ListBox) who will display all data from all Records at once. It’s the same set up as in the Eddie’s Electronics example. I could add a screenshot of what iI have so far, but I don’t understand how to upload a screenshot with a post.

its not supported, you can upload here imgbb and link it here as image.
or use google drive or your homepage webspace.

[quote=476215:@Markus Rauch]its not supported, you can upload here imgbb and link it here as image.
or use google drive or your homepage webspace.[/quote]
Thanks.

This is my UI:
The StoryListbox works and is correctly linked to the characters, everything is saved correctly into the Database file. Now I am trying to get the fields also added to a selected Story title and that being saved to the data base. (Baby steps…)

be aware that this can be slow if you have some thousands of records on a local sqlite database, and some hundreds on a remote multi user database like postgres or mysql. you need some sort of caching or paging to keep a fast user interface.

Hey @AndrvanHaren, just as an aside (but important) point, your interface appears to have four default buttons. On the Mac, there should be a maximum of one default button on each window. I’d suggest none of them should be “default” in this case. Or possibly just the new Story button.

If you’d like to change your UI to be more Mac-like, you can uncheck the Default property for each button in the Inspector.

As another aside, your toolbar icons look great!

  • The icons look a bit Windows-y.
  • Is the stories toolbar button for the stories? Or does it create a story? I’m asking because of the plus sign in the icon.
  • A window splitter is missing between the right and the left part of the window.
  • The grey background isn’t much in fashion. White is more modern right now.

Not bad at all.

[quote=476245:@Gavin Smith]Hey @André van Haren, just as an aside (but important) point, your interface appears to have four default buttons. On the Mac, there should be a maximum of one default button on each window. I’d suggest none of them should be “default” in this case. Or possibly just the new Story button.

If you’d like to change your UI to be more Mac-like, you can uncheck the Default property for each button in the Inspector.[/quote]

Thanks, Gavin. I didn’t know there was a limit in using default buttons in Mac design. I will have a look.

[quote=476301:@Beatrix Willius]- The icons look a bit Windows-y.

  • Is the stories toolbar button for the stories? Or does it create a story? I’m asking because of the plus sign in the icon.
  • A window splitter is missing between the right and the left part of the window.
  • The grey background isn’t much in fashion. White is more modern right now.

Not bad at all.[/quote]

Thanks for the tips. The layout is still very basic. At the moment I am more concerned with getting all the elements in place and get them to work. After that, I will work more on the UI itself. The Left Book button goes to the shown layout where you can add and edit stories. But the plus is a little confusing, yes. Caught me off guard as well when I came back to this project after a year.

  • The grey background isn’t much in fashion. White is more modern right now.

You mean another frame type? Not sure yet how to change frame colors…

Not sure what you mean with “window splitter”. On the left and right side there are FlexibleSpace elements.

This kind of story development software will not end up with though ends of records, The most of records (Stories) I have ever seen was around 40 tops. They are mainly to serve as examples.

With the window splitter you can make parts of the interface larger or smaller. The splitter in Xojo isn’t very good because you only can drag it at the top or the right:

This splitter here is open source: https://github.com/oleman108/imSplitter

[quote=476308:@Beatrix Willius]With the window splitter you can make parts of the interface larger or smaller. The splitter in Xojo isn’t very good because you only can drag it at the top or the right:

This splitter here is open source: https://github.com/oleman108/imSplitter[/quote]

How do I add this splitter in Xojo? It’s not a Library or property setting as far I can see it.

I watched the Using SQLite in Xojo apps video again to see if it would explain how to connect fields (Colums in the database) to a record, but because there aren’t fields used in this video, I wasn’t able to solve my problem. Is there a video to which someone can post me that shows how this is done? Here is my table and the fields in the UI: