Jump to content

cristianotestai

uniGUI Subscriber
  • Posts

    374
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by cristianotestai

  1. Hi,

    Is there a way to "eliminate" all server events thrown after one of them in web mode, to achieve something like VCL mode events sequence?.

     

    For example, in web mode, this is sample enter-exit server event sequence with two UniEdits:

    1 UniEdit1Enter

    2 UniEdit1Exit (this event server sets the focus on UniEdit1 again, but this effect is not shown until event 5)

    3 UniEdit2Enter

    4 UniEdit2Exit

    5 UniEdit1Enter (caused by event 2)

    On server event 2, a server validation is done and a SetFocus is executed, so events 3 and 4 must be ignored. How we can achieve this?

     

    In VCL mode, the sequence of events is exactly what we need:

    1 UniEdit1Enter

    2 UniEdit1Exit

    3 UniEdit1Enter

     

    Thanks in advance,

     

    Hi,

     

    Your question is same of the post http://forums.unigui.com/index.php?/topic/2021-problem-with-events-in-sequence/

    See the considerations by farshad and me..

     

    In the validation, using showmessage() will to kill upcoming server events.

     

    Regards,

     

    Cristiano

  2. Where uservalid is set to true?

     

    Also ajaRequest() works in background. It doesn't block the current thread.

     

    Hi Farshad,

     

    The uservalid could be set to true or false by AddJS or other form of interaction between client side and server side. But as ajaxRequest works in the background, what i would like to make is not possible.

  3. Just add a call to ShowControls inside DoValidUser if user is valid, why are they separate?

    And why do you want to show a mask ONLY when user is valid? Just show it before ajaxRequest() and hide inside server event UniSession.AddJS('blablabla.hideMask();')

     

    What you want in your example is possible, but you'll need to craft url and make an ajax call manually which is not good, because Farshad can change url for events in future versions of framework.

     

    hi zilav,

     

    I want to show the mask only when the user is valid because it is only this time it is loaded all the home screen, just for this.

    This was the reason to separate the two functions, because if you are in the same function, would not have given mask in server side after the user validation process.

     

    But understand, and for now will do the mask before calling the function and put in a single function.

     

    Thanks for attention zilav.

  4. Farshad, ok.. but..

     

    I have the following situation:

     

    I need to enable the screen mask on the client side after running a procedure in server side, as shown below (only to demonstrate the need..), where it should await the return of the procedure to continue execution. Any idea to enable this?

     

    // Client Side

    {

    s = 'test'; /*just example..*/

    if (s != '')

    {

    ajaxRequest(fmMain, 'DoValidUser');

    if (uservalid == true)

    {

    sender.showMask('loading'); /*the DoValidUser procedure should return true/false for showMask to be executed*/

    ajaxRequest(fmMain, 'ShowControls');

    }

    }

    }

     

    // Server Side

    procedure fmMain.DoValidUser;

    begin

    //Valid User Server Side..

    end;

     

    procedure fmMain.ShowControls;

    begin

    //Show Controls Server Side..

    end;

  5. Hi,

     

    I'm trying to work with ScreenMask using AddJS, but it does not work.

     

    procedure fmMain.Doanything;

    begin

    ..

    UniSession.AddJS('fmMain.UniButton1.showMask('Loading');

    ..

    ..

    end;

     

    But hideMask() works correctly.

     

    Any idea?

  6. It is related to internet lag. i.e. ping time. When ping time is > 200ms it may lead users to double click on buttons and cast same command several times. I'm aware of this issue.

     

     

    thanks for the reply, I hope soon to have any possible solution or any specific treatment for this case.

     

     

     

     

    If your events are synchronous the only way is to block UI until each event is fully processed. There is no other way. There is no way for framework to handle this situation internally. Of course, we can add a mode which UI is blocked after each Ajax request. This will reduce UI experience quality but you need it if your app is designed and works synchronously. If one event can't be executed more than once you need to protect it using client side UI masking techniques.

     

     

    Most of the events of my app must be synchronous, but there are processes that can be asynchronous.. Perhaps, it would to have some form of lock optionally to not perform the same event more than once.

    You said about protecting it using client side scripting with masking techniques.

    What are existing techniques that can be done? I just know the showmask() and hidemask(). There are some other way or technique to handle this need?

     

     

    Close window issue when user clicks more than once will be resolved by us.

     

    thanks.

     

    I'm aware of your problem as I encountered same issues myself in the past.

     

    Actually, there is no performance issue here, only lag from slow or distance internet connection. I don't know how heavy your app relies on Ajax events but if each and every of uset actions fires an Ajax request then your app may not work efficiently over a slow connection.

     

    In classical approach web apps were static Forms where user fills offline then click submit and send them to the server. Now with Ajax technology developers tries to use Ajax events in each action which increases number of requests. Biggest problem here is when Ajax events must be executed in certain order and executed only once. In this case several techniques are used to lock UI until Ajax task is processed.

     

    In general use of Ajax events can be abused, because some developers forget that they're designing an app for the internet not for the desktop. OK uniGUI promises both desktop and web, but it doesn't mean that developers shouldn't follow proper guidelines for web application development. That's one of the reasons which force me to push VCL part of the framework to background or even remove it from framework, because some developers misunderstand what it is meant to be.

     

    One of the misuses here is over-using of Ajax events. It leads to web apps where each user click fires one or more Ajax event. It makes app slow on the internet and difficult to manage when user cast events faster than server can handle.

     

     

     

    Yes, this is my biggest problem today that i'm finding, because some processes of my app needs to have the executions in a certain order. What are the various techniques that can be used?

     

    I have experience in object-oriented development and DataSnap with Delphi, but i'm beginner in the use of Ajax technology, so maybe at some point may be over-using Ajax events.

     

     

    You must narrow down your issues to specific cases and I'll try to guide to a proper solution. Again, as I said above many times the only solution is masking UI.

     

     

    I'll be putting in another post some real situations for you to be possible to direct the handling of Ajax events and doing the best possible way.

    Thanks for attention and your precious help.

     

    Best Regards.

  7. Hi Farshad,

     

    I started a few days ago the use of my project in production for two customers.

    The application(site) will be centralized for use on the internet, where companies will login and use the application, ie, the server is hosted in a cloud server on the internet.

    With this, and some tests in production already achieved, i am concerned about some performance issues, so i'm writing to you.

    Some of the problems i'm encountering is related delays at certain times in the execution of relatively simple tasks, but in accordance with issues

    local user's computer (processor and memory) and internet connection, there is often an excessive delay and the user remade the procedure

    that should be almost instantaneous, but at the moment there was a delay in the response from the server, especially when there is simultaneous access.

    In many cases, to not have these problems, i'll need to make the screen controls and processes for client side scripting, but there are some tasks that are more difficult to perform

    and so i have this concern with the server response time.

    There are cases that will use screen mask to inform the user about the progress of the process, but there are cases where there is no sense in doing this and by

    it need to have a faster response time because the project site will be taking a higher proportion.

    Other problems encountered is the implementation of that process more quickly than once, since, as is asynchronous, if the user makes a double click for

    close a window, ajax error occurs because the object to be released no longer exists. There are other examples like this..

    I would ask special attention to these issues about server performance and access for objects, because in my case, the application will not be local and that

    my project is as successful as expected, these vital questions need to be considered.

     

    If you consider to be interesting, i can enable a user to the site to you see and possibly talk about some of these issues.

     

    Thank you for your attention and once again thank you for the great work.

     

    Best Regards.

  8. You can customize the message.

     

    I think in a way not to have that window "Ajax Error" but to present another form or page to indicate the problem occurred.

    This will be possible or just customize the text in the window?

     

    Regards,

     

    Cristiano

  9. Does it crash web app? In what way?

     

    Hi Farshad,

     

    I expressed the wrong way.. really not crash the app, but for each access by the user or internally by the application, the window "Ajax Error" is displayed.

     

    Just for this reason i asked the question:

    In these and other cases, could something be done to display the page informing that there was a communication failure or a generic message about the problem with the site,

    instead of the window Ajax Error?

     

    Thanks again.

  10. Hi Farshad,

     

    When there is a problem with the internet connection from the user, or even a fault with the connection to the server, there is the Ajax Error with the little window, crashing the web application.

    In these and other cases, something could be done to display a page informing that there was a communication failure or a generic message about the problem with the site,

    instead of the window "Ajax Error"?

    As the attached image, when there is a failure, gmail tells what might have happened.

     

    Thanks.

    post-17-0-60738700-1335192930_thumb.jpg

  11. We can add a property to button which locks it until request is completed. You can achieve same effect yourself now using client scripting.

     

    A property for this purpose is great.. Thanks farshad.

  12. Javascript is asynchronous, so every time OnKeyDown event is called, browser doesn't actually add to unimemo and clear uniedit, it just generates ajax call to server. On server side you specify your actions, unigui converts them to javascript and sends it back to browser in response. And only when this generated javascript is executed, the changes happen.

    Each ajax call doesn't wait for previous one to complete, so if user presses Enter quickly many times, severals ajax requests will be generated to server, each containing your current text in uniedit. Until one of them is completed and uniedit is cleared, all those requests will do the same thing - add the same text to unimemo. Thats why we need masks to prevent user from generating subsequent ajax calls until application state changes.

    To make changes immediatly you'll need to write some processing logic on client side in javascript. In your case, for example, you can intercept onkeydown javascript event of uniedit and clear it from there, not on server. Or even add that text to memo and clear uniedit entirely client-side, optionally calling ajaxRequest() to inform server about changes.

     

    Thanks for explanation zilav!

  13. I need a suggestion to solve a particular side effect.

    There are events that are quick to be executed by the user, which not required to have a screen mask to block a transaction in the application.

    As an example, we have a UniEdit and UniMemo, which sets the OnKeyDown event. When the User presses the enter key, the text of UniEdit is added on the UniMemo and the text UniEdit is clear. This is a classic example ..

     

    In production mainly in cases where the text to be added is relatively large and the user presses the enter key quickly more than once, is added to the UniMemo the same text several times, ie, more than one time the event was performed ... what is wrong, because when you press the Enter key, the text of UniEdit is clear after being added to the UniMemo.

    How to not allow this and other cases happen?

     

    Thanks

  14. 1000 is not exact value. It must be height of your control.

     

    Try 2nd method I posted above.

     

    Method 2 too stay same result.. may be an issue.. but, if possible, try to make the test to see in practice.

     

    Thanks!!

  15. ("top", 1000);

     

    Hi farshad,

    using ("top", 1000), he is always on the penultimate line, not in the last.. why?

    i verified that any value above 100 he stay in penultimate line..

     

    To test:

     

    In runtime add several text until vertical bar stay enabled.

    Source code:

    begin

    UniHtmlFrame1.Html.Add(UniEdit1.Text);

    UniSession.AddJS('MainForm.UniHtmlFrame1.body.scrollTo("top",1000)');

    end;

  16. It should be scrollTo() not ScrollTo().

     

    "case sensitive".. thanks farshad..

    But i need inform in pratice anything to always show the last text added in the TUniHtmlFrame.

    I tried ("bottom", 0), but without success.

    Some solution that i can to use as value for ("top", ?), for this need above?

     

    Thanks again!

  17.  

    Hi,

     

    I try use "ScrollTo" for TUniHtmlFrame.body too, but don't work, as example below:

     

    UniSession.AddJS('MainForm.UniHtmlFrame.body.ScrollTo('+ QuotedStr('top') + ', 0)');

     

    Occours an Ajax Error reporting that the method ScroolTo is unknown for the object.

     

    Attached the image error.

     

    How it should be correct?

     

    Thanks

    post-17-0-41359400-1332880305_thumb.jpg

  18. I can not use Sleep(...), because I do not know how many time code will run inside the Begin ... end.

     

    Will there be future functionality that allows the mask to start and stop anywhere in your code?

    UniScreenMask.run

    ....

    UniScreenMask.stop.

     

    Thank you.

     

    As Farhad said, you must to use client side for this purpose..

     

    Try with hideMask() and showMask(), example:

     

    begin

    if something then

    UniSession.AddJS('MainModule.MyButton.hideMask();') //"stop" the mask

    end

  19. Hi,

     

    When i add some text to UniHtmlFrame.Html, and the VerticalBars is enabled, i need to be positioned at the last line of the UniHtmlFrame.

     

    How do i positioning the last line of TUniHTMLFrame?

     

    Thanks.

  20. Hi,

     

    I need to add text to a TUniMemo with some formatted information, as is done with UniLabels.

    Example:

    With UniLabel i do:

    Unilabel.caption := '<b> UniGui </b> is fantastic';

    The word UniGui is bold when TextConvertion = txtHTML.

     

    How to do the same with TUniMemo?

     

    Thanks.

  21. Great looking interface Cristiano.

    Congrats !

     

    Can you give me a hint on what did you use for the left and right panels?

     

     

    Off topic , sorry.

     

    Hi lema, thanks!

     

    Yes.. These panels i used in property color: $00FEFEFE and for borders i used client side scripting:

     

    function OnAfterrender(sender)

    {

    sender.body.applyStyles('border-radius:9px');

    }

     

    Best Regards!

  22. Can you tell how it can be reproduced?

     

    Hi Farshad,

     

    In my project this delay occurs, but I did some tests on the sample you sent and the same problem apparently does not occur!

    I'll see if there is any difference in the structure of classes to see what could be wrong.

     

    Thanks again ..

×
×
  • Create New...