Delphi numeric edit box code9/18/2023 ![]() At this point I feel it's fine to use a modal messagebox because the user has plainly missed the obvious cues already in front of them. The validation methods can be wrapped up so that they can be re-used when the user attempts to initiate an action requiring those inputs. This has the benefit that the user can see immediately whether or not their inputs are valid. Here I coloured the edit box red, but you can also show/hide or change the colour of a warning label above the edit box with a message detailing the expected input, use a green checkmark, or whatever else seems sensible Here if the user inputs anything invalid there is immediate visual feedback that is not intrusive like a modal message box. go ahead and do something with "theValue" If Validate1To49(Edit1.Text, theValue) then begin Procedure TForm1.Button1Click(Sender: TObject) Procedure TForm1.Edit1Change(Sender: TObject) Following David's advice, a pattern I often use looks something like this : function Validate1To49(AStr : string var Value : integer) : boolean
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |