AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Xojo weblistbox listindex12/11/2023 ![]() ![]() The SortListbox function is triggered in the HeaderPressed event handler of the WebListbox. If tempString "" And tempString str(tempString.val) And tempString.val 0 Then Me.ListIndex = 0 'highlight the first row TempString = ReplaceAll(tempString, " ", "") 'remove spaces TempString = ReplaceAll(tempString, ",", "") 'remove commas TempString = Uppercase(Me.Cell(tempInt, tempInt2)) If sortColumn = tempInt2 And numericalColumn Then 'check If the chosen column is full of only numerical data The ListIndex property is an integer from 0 to the total number of items in a list box or combo box minus 1. expression A variable that represents a ListBox object. Rec.Column("m圜olumn" + str(tempInt2)) = Me.Cell(tempInt, tempInt2) Use the ListIndex property to determine which item is selected in a list box. If fieldExistsInTable(memoryDB, "sortTable", "m圜ellTag" + Str(tempInt2)) Then rec.Column("m圜ellTag" + Str(tempInt2)) = Me.CellTag(tempInt, tempInt2) If fieldExistsInTable(memoryDB, "sortTable", "myRowTag") Then rec.Column("myRowTag") = Me.RowTag(tempInt) 'place the WebListBox data into the databaseįor tempInt As Integer = 0 to Me.RowCount - 1 rec = New DatabaseRecordįor tempInt2 As Integer = 0 to Me.ColumnCount - 1 If memoryDB.Error Then Return 'not sure why we got an error, but leave the table alone TempSQL = tempSQL + “extraSortColumnWAD DOUBLE” TempSQL = tempSQL + "m圜ellTag" + Str(tempInt) + " TEXT COLLATE NOCASE, " If Me.CellTag(0, tempInt).StringValue "" Then When the WebListbox is clicked to give it the focus When an empty row in the WebListBox is clicked When a cell is clicked even if it already is selected When a row is clicked to change the selection Clicking on a header does not call the SelectionChanged event. if myListBox IsA WebListBox then tempWebListBox WebListBox(myListBox) if tempWebListBox.ListIndex < 0 then Return 0 for tempInt As Integer 0 to tempWebListBox.RowCount - 1 if tempWebListBox. TempSQL = tempSQL + “m圜olumn” + str(tempInt) + " TEXT COLLATE NOCASE, " //Ajouter le cellTag TempSQL = tempSQL + “myRowTag” + " TEXT COLLATE NOCASE, "įor tempInt As Integer = 0 to Me.ColumnCount - 1 If rsf.Field(“ColumnName”).StringValue = fieldName Thenįunction 2 : SortListbox(sortColumn As Integer) Some comments are in french but you should find your way around…įunction 1 : fieldExistsInTable (db As SQLiteDatabase, tableName As String, fieldName As String) As Boolean Hopefully it can be usefull for someone… So thanks again to David Cox for creating the main part of this code. It surely can be optimized and by the way, let me know if you do so :). I use two Functions in a subclassed WebListbox. It works well with Strings, dates and numbers. I modified David Cox 's function for sorting WebListBox ( Link to conversation) so it can take into account RowTags and CellTags as well. ![]()
0 Comments
Read More
Leave a Reply. |