Jump to content
uniGUI Discussion Forums

Wapform

uniGUI Subscriber
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Wapform

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Wapform

    create dynamic form problem

    Main Form called out myDialogs, but the form didn't show up. Please help me to deal this problem! //============================== // Dynamic Form //============================== unit myDialogs; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIRegClasses, uniGUIForm, uniGUIBaseClasses, uniGUIVars, uniGUIApplication, uniEdit, uniButton; function Dialog(const ACaption, APrompt: string; var Value: string): Boolean; implementation function Dialog(const ACaption, APrompt: string; var Value: string): Boolean; var Form: TUniForm; Edit: TUniEdit; ButtonTop, ButtonWidth, ButtonHeight: Integer; begin Result := False; Form := TUniForm.Create(uniApplication); with Form do try BorderStyle := bsDialog; Caption := ACaption; Position := poScreenCenter; Edit := TUniEdit.Create(Form); with Edit do begin Parent := Form; Text := Value; Left := 60; Top := 60; end; with TUniButton.Create(Form) do begin Parent := Form; Caption := 'OK'; ModalResult := mrOk; Default := True; Left := 100; Top := 100; end; with TUniButton.Create(Form) do begin Parent := Form; Caption := 'Cancel'; ModalResult := mrCancel; Cancel := True; Left := 200; Top := 100; end; if ShowModal = mrOk then begin Value := Edit.Text; Result := True; end; finally Form.Free; end; end; end. //============================== // Main Program //============================== unit Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIRegClasses, uniGUIForm, uniGUIBaseClasses, uniButton; type TMainForm = class(TUniForm) UniButton1: TUniButton; procedure UniButton1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; function MainForm: TMainForm; implementation {$R *.dfm} uses uniGUIVars, MainModule, uniGUIApplication, myDialogs; function MainForm: TMainForm; begin Result := TMainForm(UniMainModule.GetFormInstance(TMainForm)); end; procedure TMainForm.UniButton1Click(Sender: TObject); var S: string; begin Dialog(' Caption ', ' Prompt ', S); Caption := S; MainForm.BorderStyle end; initialization RegisterAppFormClass(TMainForm); end.
×