![]() ![]() How to Generate Random Number (with/without a range).How to get the files/folders inside a ZIP file.How to get Drag and Drop files on your Program.Highlight a part or all of Text in TEdit.If the user does not select at least 1 item, then we show a Message Box requesting the user to select an item.Ĭlearing the list is the easiest. For example, if a list has 5 items then the will return 5, so the last item index would be 5 - 1, thus equal to - 1. The first item has index of 0 (zero) and the last item has index of - 1. If we find a selected item then we delete that item. If he has selected then we enumerate from the last item of the list to the first item. ( Just to let you know, the code above respects the MultiSelect property of the Listbox.)įirst we check if the user has selected 1 or more (>0) items. ShowMessage('Please select an item first!') We use the above code to scroll to the last item that has been added to the list, if the Checkbox is checked.įor i := - 1 downto 0 do TListBox.Items is the array of all the list items. Perhaps is better to go on this path rather than to reinvent the wheel.// Scroll to the last item of the listbox And, of course, you have the OnValidate event where you can do a test if 'Age' is between 0 and 33 (for example). for the 'Age' field the input is restricted to numbers only. Editing - you have dedicated controls for each data type (including grids for multi-row input).Of course you can clear the filter, reversing the action: Setting the Filter property to 'False' - or - issuing an SQL like: 'SELECT * FROM PETS' (without the WHERE clause) etc. Also you can use OnFilterRecord event for that. In the case of RDBMSes you can achieve it in the same way and/or using a standard SQL: 'SELECT * FROM PETS WHERE BREED='foo' ORDER BY NAME. In the case of memory datasets setting the Filter property to Breed="foo" and the Filtered property to 'True' is enough. ![]() ![]() Filter - you can do any reversible filtering on any field with any operator you like.Sort - There are simple methods to do this or if you'll choose a SQL backend a simple 'SELECT * FROM PETS ORDER BY NAME' will do your job.In the case of memory datasets you have methods like Load/SaveToFile Persistence (storage) - your RDBMS will take care of that.In this way you have solved the following problems: (You can use memory datasets like TClientDataSet, JVCL's TjvMemoryData or any other TDataSet descendant including full-blown RDBMS) You can store your objects in a data set. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |