We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ListView issues by use LDDatabase.AddListView
#1
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
Reply
#2
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.
Reply
#3
show XJWQ116.000 its run corectly.  Smile
Reply
#4
The program is ready. I hope it has no mistakes.

Show MXLJ529.000

Please let me know you found a mistake.
   
[-] The following 3 users Like martmen's post:
  • AbsoluteBeginner, litdev, Scout
Reply
#5
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.
Reply
#6
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:


   
[-] The following 1 user Likes Scout's post:
  • AbsoluteBeginner
Reply
#7
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.

   
[-] The following 2 users Like martmen's post:
  • AbsoluteBeginner, Scout
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)