![]() |
|
#1
|
|||
|
|||
|
As you know, delphi has a InputBox routine....
I want to create the same routine where instead of one field, you have (n) fields and instead of just strings, you can use any field type. so instead of... [DELPHI] function InputBox(const ACaption, APrompt, ADefault: string): string; [/DELPHI] you have something like... [DELPHI] function ExInputBox(const ACaption: String; const APrompts: array of string; const ATypes: Array of TFieldType; const ADefaults: array of string; var AValues: array of string): Boolean; [/DELPHI] where ATypes is the type expected for each (example: ftString, ftInteger, etc) and AValues are the values returned from the fields after user enters values the tricky part comes during validation what to do if the field expects an integer and the entered value is not. I'd like to see someone take this function and run with it and see what they came up with. I will then compare it against my working version and I will post mine. I will award the point to the most intuitive (not counting mine) However, of course if your's is better then my version, i may use it... If this helps, please accept as answer! Thanks! UnS ysApps |
|
#2
|
|||
|
|||
|
Quick and dirty, probably not what you are looking for but here it is...
[DELPHI]type TAppendThread = class(TThread) private { Private declarations } protected procedure Execute; override; end; . . . public procedure MyAsk(AList : Array of TMyList); { Public declarations } end; . . . procedure TForm1.Button19Click(Sender: TObject); var _MyList : Array of TMyList; _Loop : Integer; _NumberOfVals : Integer; begin _NumberOfVals := 5; SetLength(_MyList,_NumberOfVals); For _Loop := 0 to _NumberOfVals-1 do begin _MyList[_loop].Prompt := ''; _MyList[_loop].Value := ''; end; _MyList[0].Prompt := 'Question 1'; _MyList[1].Prompt := 'Question 2'; _MyList[2].Prompt := 'Question 3'; _MyList[3].Prompt := 'Question 4'; _MyList[4].Prompt := 'Question 5'; MyAsk(_MyList); end; procedure TForm1.MyAsk(AList : Array of TMyList); var _loop : Integer; begin For _Loop := 0 to Length(AList)-1 do AList[_loop].Value := InputBox('Input Box', AList[_loop].Prompt, AList[_loop].Value); end;[/DELPHI] |
|
#3
|
|||
|
|||
|
oops...
[DELPHI]type TMyList = Record Value : Variant; Prompt: String; end;[/DELPHI] |
|
#4
|
|||
|
|||
|
Curious to see the working version.
Chris |
![]() |
| Thread Tools | |
| Display Modes | |
|
|