Jump to content

Why does not work this simple code?


trey

Recommended Posts

Put on form

UniPanel1: TUniPanel;

UniButton1: TUniButton;

UniProgressBar1: TUniProgressBar;

UniLabel1: TUniLabel;

Run on WebBrowser

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics,
 Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
 uniGUIClasses, uniGUIForm, uniLabel, uniProgressBar, uniButton,
 uniGUIBaseClasses, uniPanel;

type
 TMainForm = class(TUniForm)
   UniPanel1: TUniPanel;
   UniButton1: TUniButton;
   UniProgressBar1: TUniProgressBar;
   UniLabel1: TUniLabel;
   procedure UniFormCreate(Sender: TObject);
   procedure UniButton1Click(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

function MainForm: TMainForm;

implementation

{$R *.dfm}

uses
 uniGUIVars, MainModule, ServerModule, uniGUIServer;

function MainForm: TMainForm;
begin
 Result := TMainForm(UniMainModule.GetFormInstance(TMainForm));
end;

procedure TMainForm.UniButton1Click(Sender: TObject);
var i:integer;
begin
UniProgressBar1.Max:=100; 
UniPanel1.Visible:=true;  // 1. why does not work?
for i:=0 to 100 do
 begin
   sleep(10);
   UniLabel1.Text:=inttostr(i); // 2. why does not work?
   UniProgressBar1.Position:=i; // 3. why does not work?
   Application.ProcessMessages; // 4. why does not work?
   UniProgressBar1.Refresh; // 5. why does not work?
   UniProgressBar1.RePaint; // 6. why does not work?
 end;
UniPanel1.Visible:=false; 
end;

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
UniServerModule.MainFormDisplayMode:=mfPage;
UniPanel1.Visible:=false;
end;

initialization
 RegisterMainFormClass(TMainForm);

end.

 

 

I even tried to run the UniProgressBar1.Position in a new threads , but webform is dead when the cycle runs.

Link to comment
Share on other sites

Thanks for the link. but!

Why should I write "bikes"?

why asynchronous operation can not be achieved by the component itself?

why methods Repaint, Refresh, in components when it does not work ?

 

Those methods were for desktop mode, not a web. you need to remember this is a framework for dual UI mode.

 

UniGUI is a fresh one, it's not a mature framework yet. This is its first step so you need to manage some action your-self.

 

By the way, your question is a good idea. By a "Asynchronous" nature it is possible that every UniGUI component's methods can parallel send and receive ajax-request itself, but that needs more design and take more time to implement. Implement more web UI supported by ExtJS should be the first priority, IMO.

Link to comment
Share on other sites

  • 10 years later...

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...