Listview

At the risk of being controversial I would say that the Xojo help is where I taught myself all of the above. It is very simple to use, just right-click on a variable name and you will see the last item on the drop-down is “Help for ‘VariableName’”!

http://mysite.verizon.net/vzezdg8x/id5.html

your stuffs look really good…

You can download it and play with it in the IDE for free, It was all done with only Xojo code. No declares and no plugins…

As i said it’s worth learning the listbox API… It is amazingly flexible. Yes it’s a bit complicated but it is usually a lot easier than rolling your own from scratch once you know it.

  • Karen

will do karen.

Just to take Karen’s code example a little further I have created a SQLite Database viewer program that uses a modified Listbox. This took me about an hour to complete. Download the project file here:

https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/DataAwareListbox.xojo_binary_project.zip

Missing file - HD:Users:simberr:Dropbox:Documents:REALBasic Projects:Components:SAB Components:Xojo Extras:dbListbox.xojo_binary_code

I think you were a bit quick - DropBox hadn’t uploaded it yet!

I have just tried and it now seems to work.

-Simon.

LOL - I’m not stalking you. Just happened to read it as you posted.

I still have the same missing file. Your system will resolve the link as it’s valid there.

“ColumnType in the Recordset”

It is not 100% reliable. I tried to use if to create a generic RecordSet to PDF table method. It is fine if the records a logical to make them decimal aligned, etc but SQLite does not use them so I let the user assign them manually.

This is true in SQLite. If the table has been created with the ‘proper’ field types and you are directly reading the table then SQLite will return the correct Column type.

However, a query view to SQLite will return a text field even for a computed numerical value. This makes it difficult to format he columns automatically.

The dbListbox class that I have shown here was a quick and dirty solution that will need customising by the developer. It was created in a short period of time to demonstrate the ease in which the Listbox can be subclassed and used.

I agree that the user should specify the column type at design time with a particular view in mind. This is what I do in MagicListbox.

Thanks for reminding me about the SQLite quirks!

what i did is to check for fieldname with ‘price’ or ‘amount’ etc and then right align them in the listbox.

I’ve recently also read something interesting about the UI listview control.

I have developed my own sqlite database/recordset classes, and I didn’t encounter this problem.

You can make a test of the column “affinity” assigned by the SQLite engine by doing

SELECT typeof(YourFieldOrCalculationHere) FROM SomeTable;

and - at least for the calculated fields I tested - it returns ‘integer’ in the cases you’d expect to return integers.
What you can always do to be on the safe side is to use CAST( AS ).

But maybe you’re speaking of SQLite v2?

i didn’t know you can use ‘typeof’ on sqlite… anyway i try it on integer and boolean field and both show typeof as integer.

Only the “SQL 99 Standard” introduced a boolean data type, but most SQL databases don’t have a boolean data type, they just map it onto an integer or so.

i see… so it is better to have boolean value or integer value if all the value i need is 1 or 0

DatabaseField.BooleanValue