Small Basic Forum
ListView issues by use LDDatabase.AddListView - Printable Version

+- Small Basic Forum (https://litdev.uk/mybb)
+-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1)
+--- Forum: Extensions (https://litdev.uk/mybb/forumdisplay.php?fid=3)
+--- Thread: ListView issues by use LDDatabase.AddListView (/showthread.php?tid=606)



ListView issues by use LDDatabase.AddListView - martmen - 06-08-2026

Hello everyone,

I have the following problem:
I create a ListView in a program using

LV = LDDataBase.AddListView(Width, Height)

With

LDControls.ListViewSelectionChanged = ListViewSelectionChanged 

the subroutine ListViewSelectionChanged is supposed to be called when a row in the ListView is selected.

With
DBQuerry = LDDataBase.Query(DB, "Select * from " + TableName[BP], LV, "True") 
I fill the ListView with all values from the defined table. Two records are present.
The program parts look like this:
SVSC = "False" 
LDFocus.SetFocus(TBInput[1][InputText[1]]) 
Running = "True" 
While Running = "True" 
Program.Delay(20) 
CheckButtonPressed() 
CheckListViewSelect() 
EndWhile 
Program.End()
Sub CheckListViewSelect 
If SVSC = "True" Then 
SelectedRow = LDControls.LastListViewRow 
TextWindow.WriteLine(SelectedRow) 
LVValues = LDControls.ListViewGetRow(LV, SelectedRow) 
TextWindow.WriteLine(LVValues) 
SVSC = "False" 
TextWindow.WriteLine("CheckListViewSelect " + SVSC) 
EndIf 
EndSub
Sub ListViewSelectionChanged 
SVSC = "True" 
TextWindow.WriteLine("ListViewSelectionChanged " + SVSC) 
EndSub
Nothing is printed in CheckListViewSelect.
Does it not work because the ListView was defined using
LV = LDDataBase.AddListView(Width, Height) 
?
LitDev, could you please check this and possibly provide a solution?
Thank you
Martin
Show program GXMV538.000


RE: ListView issues by use LDDatabase.AddListView - litdev - 06-09-2026

Hi,
It's been a while since any activity here!
Good to hear from you, so just a quick reply that I will look into it.


RE: ListView issues by use LDDatabase.AddListView - martmen - 06-09-2026

show XJWQ116.000 its run corectly.  Smile


RE: ListView issues by use LDDatabase.AddListView - martmen - 06-10-2026

The program is ready. I hope it has no mistakes.

Show MXLJ529.000

Please let me know you found a mistake.
   


RE: ListView issues by use LDDatabase.AddListView - litdev - 06-10-2026

Hi,
This mostly works for me, a couple suggestions.
1] The postcode field is a bit short
2] It only seems to save one address, the last one saved - I was testing by just changing the first name and saving.
I haven't tried debugging to see if it is a bug or I am doing something wrong.
I also use https://sqlitebrowser.org to see the contents of the db.


RE: ListView issues by use LDDatabase.AddListView - Scout - 06-10-2026

Hi Martmen,
Your program is a good example of how data in an SQLite database can be edited and searched.
Since only a ListView is available—and not a DataView—we need these input fields.
I have a suggestion regarding the user interface layout:
The current program switches between the ListView and the input fields, depending on whether there is a single match or multiple matches. Why not simply place the ListView to the right of the input fields? There is plenty of space, and the ListView is scrollable.
Here is an example with just two input fields, arranged vertically:


   


RE: ListView issues by use LDDatabase.AddListView - martmen - 06-11-2026

Hi Scout,
The ListView is only used for selecting a business partner when multiple matches are found in the database. The business partner has additional data that I did not show in the example. Attached is a screenshot with more data. These values are entered in a DataView.