Nov 14, 2012 Replies: 13 May be of use to someone but posted more to gather some feedback about what features people would like to see in a set of data bound views. The DBSpinner adds the following methods to the vanilla Spinner: SetDatabase(DB As SQL): Set the database connection to use. SetRowSource(SelectStatement AS String): Sets the SQL SELECT statement that will populate the Spinner GetRowSource(): Returns the SELECT statement. Requery(): Clears the spinner and populates it with the result of SELECT statement specified in SetRowSource() Attachments dbcontrols.zip dbcontrols.zip 104.9 KB · Views: 909 Click to expand...
May be of use to someone but posted more to gather some feedback about what features people would like to see in a set of data bound views. The DBSpinner adds the following methods to the vanilla Spinner: SetDatabase(DB As SQL): Set the database connection to use. SetRowSource(SelectStatement AS String): Sets the SQL SELECT statement that will populate the Spinner GetRowSource(): Returns the SELECT statement. Requery(): Clears the spinner and populates it with the result of SELECT statement specified in SetRowSource()
R Roger Garstang Well-Known Member Licensed User Longtime User Nov 14, 2012 #2 Lots of people have been requesting Default Selection capabilities in Spinners. I made a Spinner out of a Label in my View Manager Class just to have more control over that and how text draws.
Lots of people have been requesting Default Selection capabilities in Spinners. I made a Spinner out of a Label in my View Manager Class just to have more control over that and how text draws.
M Mahares Expert Licensed User Longtime User Nov 14, 2012 #3 Nice library. It reminds me of Microsoft Access. It would be really nice if you can include more than one column in the SetRowSource and then have the ability to return one of the columns when clicked. Something like this: Code: myDBSpinner.SetRowSource("SELECT SKU, SHRT_DESC FROM PARTLIST ORDER BY SHRT_DESC ")
Nice library. It reminds me of Microsoft Access. It would be really nice if you can include more than one column in the SetRowSource and then have the ability to return one of the columns when clicked. Something like this: Code: myDBSpinner.SetRowSource("SELECT SKU, SHRT_DESC FROM PARTLIST ORDER BY SHRT_DESC ")
R Roger Garstang Well-Known Member Licensed User Longtime User Nov 14, 2012 #4 That was another thing I needed was an ID associated with Text (Also in my View Manager Class implementation). I've actually started converting it to a B4A Library (About 25% complete) and I can't really find a way to make Spinners store things like that. I'd really like to use the standard spinner since in a library, but it may be too limited. I did see that Spinners have two modes (Dialog and Dropdown) which I didn't know of and would be a nice addition to B4A.
That was another thing I needed was an ID associated with Text (Also in my View Manager Class implementation). I've actually started converting it to a B4A Library (About 25% complete) and I can't really find a way to make Spinners store things like that. I'd really like to use the standard spinner since in a library, but it may be too limited. I did see that Spinners have two modes (Dialog and Dropdown) which I didn't know of and would be a nice addition to B4A.
grant1842 Active Member Licensed User Longtime User Nov 15, 2012 #5 Thanks for your work . I think dbaware views are great.
K keirS Well-Known Member Licensed User Longtime User Nov 15, 2012 #6 Mahares said: Nice library. It reminds me of Microsoft Access. It would be really nice if you can include more than one column in the SetRowSource and then have the ability to return one of the columns when clicked. Something like this: Code: myDBSpinner.SetRowSource("SELECT SKU, SHRT_DESC FROM PARTLIST ORDER BY SHRT_DESC ") Click to expand... You can do that. In the example if you change the RowSource to: Code: myDBSpinner.SetRowSource("SELECT SKU,SHRT_DESC FROM PARTLIST ORDER BY SKU") And the ItemClick to: Code: Sub Spin_ItemClick(Position As Int, Value As Object) Dim getCursor As Cursor getCursor = myDBSpinner.GetCursor() getCursor.Position = Position ToastMessageShow("Description = " & getCursor.GetString("SHRT_DESC"),False) End Sub You can get the SHRT_DESC field. The Spinner just populates itself with the first column in the cursor and ignores the others.
Mahares said: Nice library. It reminds me of Microsoft Access. It would be really nice if you can include more than one column in the SetRowSource and then have the ability to return one of the columns when clicked. Something like this: Code: myDBSpinner.SetRowSource("SELECT SKU, SHRT_DESC FROM PARTLIST ORDER BY SHRT_DESC ") Click to expand... You can do that. In the example if you change the RowSource to: Code: myDBSpinner.SetRowSource("SELECT SKU,SHRT_DESC FROM PARTLIST ORDER BY SKU") And the ItemClick to: Code: Sub Spin_ItemClick(Position As Int, Value As Object) Dim getCursor As Cursor getCursor = myDBSpinner.GetCursor() getCursor.Position = Position ToastMessageShow("Description = " & getCursor.GetString("SHRT_DESC"),False) End Sub You can get the SHRT_DESC field. The Spinner just populates itself with the first column in the cursor and ignores the others.
M Mahares Expert Licensed User Longtime User Nov 15, 2012 #7 Thanks KeirS. Selecting the correct column works well. The only drawback is: When you select more than one column in the rowsource, only one column displays when the spinner is displayed.
Thanks KeirS. Selecting the correct column works well. The only drawback is: When you select more than one column in the rowsource, only one column displays when the spinner is displayed.
K keirS Well-Known Member Licensed User Longtime User Nov 15, 2012 #8 Yes. The spinner is just an extension of the one provided in B4A. While it is possible to have multi-column spinners in Android (and I may look at it in the future) I want to concentrate on getting a collection of data bound views based on the existing ones available in B4A before looking at anything else.
Yes. The spinner is just an extension of the one provided in B4A. While it is possible to have multi-column spinners in Android (and I may look at it in the future) I want to concentrate on getting a collection of data bound views based on the existing ones available in B4A before looking at anything else.
R Roger Garstang Well-Known Member Licensed User Longtime User Nov 16, 2012 #9 So, the Cursor persists as long as the view? When I was reading about setting a cursor for an AutoComplete EditText it seemed to indicate that you needed to monitor events and create the cursor when the listview was opened/requested and close the cursor when the listview was closed/dismissed otherwise there would be a leak. In my class that I'm now building my library from I had used a cursor to read DB values and Save/Restore State of views, but a List of Types for the Spinner values (It was built using a cursor, but the cursor was closed after built). I also had a lot of issues with SQL connections closing on me and/or the variables getting deleted even when Process Globals. I ended up making everything used as needed to populate a static list and closed after use.
So, the Cursor persists as long as the view? When I was reading about setting a cursor for an AutoComplete EditText it seemed to indicate that you needed to monitor events and create the cursor when the listview was opened/requested and close the cursor when the listview was closed/dismissed otherwise there would be a leak. In my class that I'm now building my library from I had used a cursor to read DB values and Save/Restore State of views, but a List of Types for the Spinner values (It was built using a cursor, but the cursor was closed after built). I also had a lot of issues with SQL connections closing on me and/or the variables getting deleted even when Process Globals. I ended up making everything used as needed to populate a static list and closed after use.
K keirS Well-Known Member Licensed User Longtime User Nov 16, 2012 #10 Yes it persists. Never seen the issues you describe. This may well be to do with the environment my Apps are used in. Tablets where they are quite heavily locked down and some even locked down with pseudio kiosk mode. I will do some serious stress testing and see what happens.
Yes it persists. Never seen the issues you describe. This may well be to do with the environment my Apps are used in. Tablets where they are quite heavily locked down and some even locked down with pseudio kiosk mode. I will do some serious stress testing and see what happens.
S sellnet New Member Licensed User Longtime User Dec 20, 2012 #11 DBSpinner crashing keirS said: May be of use to someone but posted more to gather some feedback about what features people would like to see in a set of data bound views. The DBSpinner adds the following methods to the vanilla Spinner: SetDatabase(DB As SQL): Set the database connection to use. SetRowSource(SelectStatement AS String): Sets the SQL SELECT statement that will populate the Spinner GetRowSource(): Returns the SELECT statement. Requery(): Clears the spinner and populates it with the result of SELECT statement specified in SetRowSource() Click to expand... This library is exactly what I need. However, it simply won't run for me. The sample app you provided crashes as soon as I open it. I can get your spinner to appear on activities in my app, but they are not populated and as soon as I try to click on them, the app crashes. I am using B4A 2.00 and testing on a Samsung Galaxy S3 with running 4.1.1 Any ideas?
DBSpinner crashing keirS said: May be of use to someone but posted more to gather some feedback about what features people would like to see in a set of data bound views. The DBSpinner adds the following methods to the vanilla Spinner: SetDatabase(DB As SQL): Set the database connection to use. SetRowSource(SelectStatement AS String): Sets the SQL SELECT statement that will populate the Spinner GetRowSource(): Returns the SELECT statement. Requery(): Clears the spinner and populates it with the result of SELECT statement specified in SetRowSource() Click to expand... This library is exactly what I need. However, it simply won't run for me. The sample app you provided crashes as soon as I open it. I can get your spinner to appear on activities in my app, but they are not populated and as soon as I try to click on them, the app crashes. I am using B4A 2.00 and testing on a Samsung Galaxy S3 with running 4.1.1 Any ideas?
I ikidd Member Licensed User Longtime User Feb 24, 2013 #12 I get this when I click on the spinner. It seems to populate and work with the buttons in the demo, but touch the spinner and it crashes and logcats: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application I'm thinking it's not instantiating the control correctly.
I get this when I click on the spinner. It seems to populate and work with the buttons in the demo, but touch the spinner and it crashes and logcats: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application I'm thinking it's not instantiating the control correctly.
Sannie72 Member Licensed User Longtime User Jan 7, 2014 #13 Spinner works fine, I need the second datafield, so this is great! However, my app is in Holo.light, the dbspinner is holo dark (white chars on dark background). The result is unuseable (does not look very professional). When I change .color and .textcolor properties, the spinner itself changes (although the bottom right triangle indicating a spinner is invisible) but the list with values is still holo.dark theme. Any suggestions? (running B4A 3.20 BETA 1 on Galaxy S3, 4.3)
Spinner works fine, I need the second datafield, so this is great! However, my app is in Holo.light, the dbspinner is holo dark (white chars on dark background). The result is unuseable (does not look very professional). When I change .color and .textcolor properties, the spinner itself changes (although the bottom right triangle indicating a spinner is invisible) but the list with values is still holo.dark theme. Any suggestions? (running B4A 3.20 BETA 1 on Galaxy S3, 4.3)
K keirS Well-Known Member Licensed User Longtime User Jan 13, 2014 #14 The spinner is just an wrapper of the standard B4A spinner class. I will rebuild the library with the latest B4A libraries and see if that solves the problem. Sorry for not replying to other peoples issues but I have only just back to developing in B4A. Been to busy with other projects to do any Android stuff. Now have a big Android project on the go so will hopefully be releasing a few bits and pieces.
The spinner is just an wrapper of the standard B4A spinner class. I will rebuild the library with the latest B4A libraries and see if that solves the problem. Sorry for not replying to other peoples issues but I have only just back to developing in B4A. Been to busy with other projects to do any Android stuff. Now have a big Android project on the go so will hopefully be releasing a few bits and pieces.