PDA

View Full Version : popup Dlg (with editbox in it output to variable)



ShowerThoughts
03-04-2008, 10:12 PM
hey

i want this

when i click a button
this must happen
a DlG(dialog) pop up with a edit box in it you put a site(string) in it and it gets saved in string.

almost the same as readln in scar

Hermpie

@boreas: already thanks

bullzeye95
03-05-2008, 01:21 AM
What's the difference from ReadLn?

ShowerThoughts
03-07-2008, 05:08 PM
let me say, it's the same as readln but then in delphi, and i don't like it that you always look for this little bug typed text ... i know my english sucks and everyone makes mistakes but i just get pissed of that kinds of things...

Wizzup?
03-07-2008, 05:13 PM
I guess you could make another form, that you load and popup( Form2.Show; ) when you call the function. The form should contain one edit box. After the Button is closed, close the form and free it again.

ShowerThoughts
03-07-2008, 05:18 PM
thanks! dan told me the same yet to bad they don't got a dialog for it but thanks wizzup?

Wizzup?
03-07-2008, 05:26 PM
thanks! dan told me the same yet to bad they don't got a dialog for it but thanks wizzup?

Well, if TForm1 is your 'first' form, this could be a usefull procedure.

procedure TForm1.AddForm(Sender: TObject);

begin
Form1.Show; // To replace the ShowModal. (You can't have two ShowModals at the same time...
Application.CreateForm(TForm2, Form2);
Form2.ShowModal;
end;

And perhaps in your Form2 code:

procedure TForm2.FreeIt(Sender: TObject; var Action: TCloseAction);
begin
//Freeing stuff here.
end;

And your Form2.InitForm should just contain the creation of the edit box with a button.

ShowerThoughts
03-07-2008, 05:34 PM
i need to use this when i want to let show this dialog?

nielsie95
03-07-2008, 05:56 PM
function InputQuery(const ACaption, APrompt: string; var Value: string): Boolean;
function InputQuery(const ACaption, APrompt: WideString; var Value: WideString): Boolean; overload;
function InputQuery(const ACaption, APrompt: WideString; var Value: string): Boolean; overload;
function InputQuery(const ACaption, APrompt: WideString; var Value: Double, Min: Double = Low(Integer); Max: Double = High(Integer); Decimals: Integer = 1): Boolean; overload;
function InputQuery(const ACaption, APrompt: WideString; var Value: Integer, Min: Integer = Low(Integer); Max: Integer = High(Integer); Increment: Integer = 1): Boolean; overload;


Example: InPutQuery('Find Window', 'Enter the exact name of the window:', str)

Sumilion
03-07-2008, 06:46 PM
function InputQuery(const ACaption, APrompt: string; var Value: string): Boolean;
function InputQuery(const ACaption, APrompt: WideString; var Value: WideString): Boolean; overload;
function InputQuery(const ACaption, APrompt: WideString; var Value: string): Boolean; overload;
function InputQuery(const ACaption, APrompt: WideString; var Value: Double, Min: Double = Low(Integer); Max: Double = High(Integer); Decimals: Integer = 1): Boolean; overload;
function InputQuery(const ACaption, APrompt: WideString; var Value: Integer, Min: Integer = Low(Integer); Max: Integer = High(Integer); Increment: Integer = 1): Boolean; overload;


Example: InPutQuery('Find Window', 'Enter the exact name of the window:', str)

Hmm, that line seems familiar :p

ShowerThoughts
03-07-2008, 07:36 PM
can you give an example?

Dan Cardin
03-07-2008, 08:51 PM
const
a = 'website';
b = 'what is the name of the website';
var
c: string;
procedure ask;
begin
InputQuery(a, b, c);
edit.text := c
end;

EDIT: yep that example works

ShowerThoughts
03-07-2008, 09:23 PM
i yet made a cool form for it...

can some1 tell me why i can't see the 'childs on form2'

Form2.Show;
Link1.Caption:=(GetBetween(Site,'.','.'));


got that in it
the form compiles i can see form2 but not the childs

ps. can some1 fix this

Function HWait (MaxTime:Integer; HUntil:Boolean): Boolean;
Var
Time : Integer;
Begin
MarkTime(Time);
Repeat
Wait(100 + Random(50));
Until HUntil or (TimeFromMark(Time) > MaxTime);
End;
for scar, so you can fill in somthing like infight; or bankscreen; (in HUntil)

bullzeye95
03-07-2008, 10:20 PM
program New;

function Bool: Boolean;
begin
Result:= Random(100) = 0;
end;

procedure HWait(MaxTime: Integer; HUntil: Function: Boolean);
var
T: Integer;
begin
T:= GetSystemTime;
while not HUntil() and not(GetSystemTime - T > MaxTime) do
wait(50);
end;

begin
HWait(5000, @Bool);
end.
Something like that?

ShowerThoughts
03-07-2008, 10:22 PM
Wrong thread and WTF?(not blaming you)
no thats not what i mean check other thread