Jump to content

Recommended Posts

Posted

https://unigui.miraheze.org/wiki/Mobile_Version_of_InputQuery

 

The link above tells how to use it.

function mInputQuery(aPrompt: string; aTitle: String; var rtnValue: String; InputType: String=''): Boolean;
var
    fModal  : TUnimForm;
    aMsg  : TUnimlabel;
    aInput  : TUnimEdit;
    btnOK  : TunimButton;
    btnCancel: TunimButton;
begin
    result  := False;
    fModal  := TUnimForm.Create(UniApplication);
    fModal.Caption := aTitle;

    aMsg  := TUnimlabel.Create(fModal);
    aMsg.Parent  := fModal;
    aMsg.Margins.Top  := 50;
    aMsg.Margins.Left  := 30;
    aMsg.Margins.Right  := 30;
    aMsg.AlignWithMargins := True;
    aMsg.Align  := alTop;
    aMsg.Caption  := aPrompt;

    aInput  := TUnimEdit.Create(fModal);
    aInput.Parent  := fModal;
    aInput.Margins.Top  := 50;
    aInput.Margins.Left  := 30;
    aInput.Margins.Right  := 30;
    aInput.AlignWithMargins := True;
    aInput.Align  := alTop;
    if (InputType <> '') then
        (aInput as IUniJSInterface).JSConfig('inputType', [''+InputType+'']);

    btnCancel  := TunimButton.Create(fModal);
    btnCancel.Parent  := fModal;
    btnCancel.Caption  := 'Cancel';
    btnCancel.Width  := Trunc((UniApplication.ScreenWidth - (2 * aMsg.Margins.Left)) / 2 - (aMsg.Margins.Left / 2));
    btnCancel.Top  := aMsg.Margins.Top + aMsg.Height + aInput.Height + 20 + (fModal.Height - fModal.ClientHeight);
    btnCancel.Left  := aMsg.Margins.Left;
    btnCancel.ModalResult := mrCancel;

    btnOK  := TunimButton.Create(fModal);
    btnOK.Parent  := fModal;
    btnOK.Caption  := 'OK';
    btnOK.Width  := btnCancel.Width;
    btnOK.Left  := UniApplication.ScreenWidth - aInput.Margins.Right - btnOK.Width;
    btnOK.Top  := aMsg.Margins.Top + aMsg.Height + aInput.Height + 20 + (fModal.Height - fModal.ClientHeight);
    btnOK.ModalResult := mrOk;

    result := (fModal.ShowModal() = mrOk);

    rtnValue := aInput.Text;
end;
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...