FFREDIANELLI Posted September 18, 2018 Share Posted September 18, 2018 how to use inputbox in unigui ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 18, 2018 Share Posted September 18, 2018 \FMSoft\Framework\uniGUI\Demos\Desktop\Prompt Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted September 19, 2018 Author Share Posted September 19, 2018 OK , but it pass thru it without asking nothing what can be the cause , some clue ? Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted September 19, 2018 Author Share Posted September 19, 2018 synchronous operations is alwready on... Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted September 19, 2018 Author Share Posted September 19, 2018 This is the segment of the program that was adapted from inputbox to PROMPT, This program in vcl accept a sql query with #[n/Ano:] in the place where it asks for the parameter for example: Select * from sometable where year(data)=#[n/Year:] and month(data)=#[n/Month:] in vcl it stops ask first for the year and in another ask the month Procedure TMainForm.UniSFBitBtn1Click(Sender: TObject); var s, s1: string; i: Integer; c: string; k, tipo, pergunta: string; P1, p2, p3: Integer; iValue, iCode: Integer; begin pGrid.Visible := false; Pquery.Visible := false; pResult.Align := alclient; pResult.Visible := true; if ((POS('UPDATE', strupper(qQueryQUERY.value)) > 0) OR (POS('DELETE', strupper(qQueryQUERY.value)) > 0) OR (POS('INSERT', strupper(qQueryQUERY.value)) > 0) OR (POS('EXEC', strupper(qQueryQUERY.value)) > 0)) AND (usunivel < 11) then BEGIN showmessage('Seu nível de acesso não permite executar esta alteração'); exit END; qResult.SQL.Add(qQueryQUERY.value); s := qResult.SQL.Text; ref := ''; while POS('#', s) > 0 do begin P1 := POS('#', s); p2 := POS(']', s); k := copy(s, P1, p2 - P1 + 1); tipo := copy(k, 3, 1); if tipo = 'n' then begin repeat Prompt(copy(k, 5, len(k) - 5), '', mtInformation, mbOKCancel, PromptCallBack); val(valor, iValue, iCode); if iCode <> 0 then valor := ''; until valor <> ''; strchange(s, k, valor); ref := ref + valor; end; if tipo = 's' then begin repeat //---- In Debug it just pass here and do not stop... Prompt(copy(k, 5, len(k) - 5), '', mtInformation, mbOKCancel, PromptCallBack); until valor <> ''; strchange(s, k, valor); ref := ref + valor; end; end; // sLabel1.Caption := 'Aguarde...'; Application.ProcessMessages; qResult.SQL.Text := s; try if (POS('UPDATE', strupper(qResult.SQL.Text)) = 0) AND (POS('DELETE', strupper(qResult.SQL.Text)) = 0) AND (POS('EXEC ', strupper(qResult.SQL.Text)) = 0) THEN BEGIN qResult.open; for i := 0 to qResult.FieldCount - 1 do begin if qResult.Fields.DisplayWidth > 100 then qResult.Fields.DisplayWidth := 100; end; END ELSE BEGIN try qResult.Execute; showmessage('SQL executado'); except showmessage('Erro ao executar comando'); end; END; except showmessage('Erro ao interpretar query...'); end; end; procedure TMainForm.PromptCallBack(Sender: TComponent; AResult: Integer; AText: string); begin if AResult = mrOK then begin valor := AText; end; end; Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted September 19, 2018 Author Share Posted September 19, 2018 if i put a showmessage in the place of prompt it stops and show... so prompt it's not modal ? or something can change this ? showmessage(copy(k, 5, len(k) - 5)); Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted September 19, 2018 Administrators Share Posted September 19, 2018 You need to use Blocking version of prompt. function Prompt(const AMsg, AValue: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; var UserValue: string; MultiLines:Boolean): Integer; Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted September 19, 2018 Author Share Posted September 19, 2018 Thanks Farshad. but why the function to not have another name... ? for the newbies will be easyer... But works very well !!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.