Jump to content
uniGUI Discussion Forums
cristianotestai

Questions about ScreenMask

Recommended Posts

Hello Farshad,

 

I have some questions about the use of ScreenMask.

1) I need a way to show the user when a form is being loaded. How should I use ScreenMask or another solution for the loading of forms? There are cases where the connections are slower and you need to show the user being loaded...

2) How to use screenmask, or another solution to present to the user that some information is being processed, such as creation of several panels at run time or any other need for a procedure to update the interface?

3) I do not want to put any text in ScreenMask, but if i leave the property empty, the default message is displayed. Is it a bug?

 

Thanks for attention,

 

Best Regards,

 

Cristiano Testai

Share this post


Link to post
Share on other sites

Difficult to answer this question because its unclear what you want. I use UniScreenMask with UniStatusBar.

 

If bandwidth/connection is an issue you should not assume you can communicate with server showing progress.

In this case.Display your own modal dialog and close it when process is completed.

Share this post


Link to post
Share on other sites

Hi ibandyop,

 

What I need is relatively simple, is something like:

 

procedure DoSomething;

begin

try

ScreenMask.Initialize; //something like Delphi Desktop Aplication: Screen.Cursor = crSqlWait;

CreateUniPanels;

Call Business Rules

.. something

.. something

finally

ScreenMask.Finalize; //something like Delphi Desktop Aplication: Screen.Cursor = crDefault;

end;

end;

 

As i said previously, exists situations where can not only referenced a control, but a generic procedure.

 

Thanks for your attention.

Share this post


Link to post
Share on other sites

Cristiano:

 

That You want is not possible to made in the Way that you show there.

 

Thinks that allways a Web Application is a Client/Server app.

 

The page request a response from the server and the server responds the request.

 

I you want to show a wait when a form is created and quit the show when the form is done, you cannot do this in a single event handler, because:

 

1) The page request the creation of a form sending a Ajax request to the server.

2) The server executes the event handler. Until the server is not execute totally the event, client only wait to server response.

3) The server send javascript commands to the page as response of the page request.

4) The client executes the javascript and as consequence the form is showed on the page.

 

The best way to do this is using a custom ajax event manager or modifing the actual to show a "wait cursor" until the server responds request.

 

Y made a simulation of this using TUniScreenMask setting a screen mask targeting at no one (assume all page) to all buttons and keypress events handlers via a generic routine.

 

There is the code (sorry spanish):

 

{ Configura las máscaras de espera y las grillas de los formularios o frames }
procedure ConfiguraForm(p_formFrame: TWinControl; p_formParent: TfrmBase);
var
 i: Integer;

 procedure CrearMascara(p_componente : TComponent);
 var
   l_mask : TUniScreenMask;
 begin

   { Crear la máscara }
   l_mask := TUniScreenMask.Create(p_formParent);
   p_formParent.InsertComponent(l_mask);

   with l_mask do
   begin
     AttachedControl := p_componente;
     DisplayMessage := 'Procesando...';
   end; // with
 end;

 procedure ProcesaComponente(p_component: TComponent);
 var
   i: Integer;
   l_panel: TUniPanel;
   l_page: TUniPageControl;
   l_tab: TUniTabSheet;
   l_edit: TUniEdit;
   l_frame: TFrame;
   l_grid: TUniDBGrid;
   l_cds : TClientDataSet;
 begin

   { Recorrer todos los controles contenidos }
   if p_component is TUniPanel then
   begin
     l_panel := TUniPanel(p_component);

     for i := 0 to l_panel.ControlCount - 1 do
       ProcesaComponente(l_panel.Controls[i]);
   end
   else if p_component is TUniPageControl then
   begin
     l_page := TUniPageControl(p_component);

     //CrearMascara(l_page);

     for i := 0 to l_page.PageCount - 1 do
       ProcesaComponente(l_page.Pages[i]);
   end
   else if p_component is TUniTabSheet then
   begin
     l_tab := TUniTabSheet(p_component);

     for i := 0 to l_tab.ControlCount - 1 do
       ProcesaComponente(l_tab.Controls[i]);
   end
   else if p_component is TFrame then
   begin
     l_frame := TFrame(p_component);

     for i := 0 to l_frame.ControlCount - 1 do
       ProcesaComponente(l_frame.Controls[i]);
   end
   else if p_component is TUniButton then
     CrearMascara(p_component)
   else if p_component is TUniBitBtn then
     CrearMascara(p_component)
   else if p_component is TUniEdit then
   begin
     l_edit := TUniEdit(p_component);

     if l_edit.CharEOL = #13 then
       CrearMascara(p_component);
   end
   else if p_component is TUniDBGrid then
   begin
     l_grid := TUniDBGrid(p_component);

     l_grid.WebOptions.Paged := false;
     l_grid.WebOptions.LoadMask := True;
     l_grid.WebOptions.LoadMaskMsg := 'Procesando...';
   end
   else if p_component is TClientDataSet then
   begin
     l_cds := TClientDataSet(p_component);
     l_cds.OnReconcileError := p_formParent.cdsReconcileError;
   end; // if
 end;

begin
 for i := 0 to p_formFrame.ComponentCount - 1 do
   ProcesaComponente(p_formFrame.Components[i]);
end;

 

Then when a button is pressed a wait shows until the button code is executed.

 

I hope be ussefull.

Share this post


Link to post
Share on other sites

Hi Oscar,

 

Thanks for explanation and by your code.

 

I posted in Bug Reports that Screen Mask not work with UniLabel, you confirm?

 

Thanks.

Share this post


Link to post
Share on other sites

Yes if you attach the TUniScreenMask to a TUniLabel don't work as spected.

 

But I suppose that You use the TUniLabel as Embedded HTML to do a HTML Link (<a href=""/>) or some else issue.

 

Normally when must to do some special processing when a html link is pressed You need to attach a custom javascript code.

 

There are many examples on the Internet (normally with PHP) of how you can do this.

Share this post


Link to post
Share on other sites

Hello Farshad,

 

I have some questions about the use of ScreenMask.

1) I need a way to show the user when a form is being loaded. How should I use ScreenMask or another solution for the loading of forms? There are cases where the connections are slower and you need to show the user being loaded...

2) How to use screenmask, or another solution to present to the user that some information is being processed, such as creation of several panels at run time or any other need for a procedure to update the interface?

3) I do not want to put any text in ScreenMask, but if i leave the property empty, the default message is displayed. Is it a bug?

 

 

Logged #1140

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×