Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mainform update on return from subform ?
#1
Hi,

I have an iwlabel on my mainform, showing contents from a usersession var, which is modified during the life of a subform called from mainform. When releasing the subform and returning to  the mainform, I would like to see the new value in the label.

Is it possible to update just the label (like iwlabel.update) or is the only solution to reload the mainform ? And if mainform has to be reloaded, what is the best way to do that ? Clicking a hidden button with DoSubmitValidation set to true ?

Regards
Soren
Reply
#2
Hi Soren, in IWLabel you can set property RawText := True; and put in the label the direct HTML code you want.
Reply
#3
Im not sure Im clear on what the issue is, but if you have form1 and form2.. you can change form1 while keeping it in memory. When form2 is released, form1 will show with the changes you've applied to controls.
Reply
#4
Soren, How is the value from UserSession put in the label initally? The label will update if its value is changed, but if you changed a value elsewhere and didn't put it in the label it doesn't know to update.

I assume you are setting the value in some event?

Dan
Reply
#5
Hi Guys,

Thanks for your input. I'm sorry I was a bit unclear. I have found a working solution but I'm not sure it is correct. I mean, I am not sure it is the right way of solving the problem and I might post another question later, once I've tested a bit more.

The uncertainty is caused by a lack of understanding the application process flow in various situations, fx. after events like OnClick and OnAsyncCick. The solution to my problem was realizing that at the return to the mainform, it was processed anew, like it was just launched, and not as I believed, at the point in the code right after the line where I call the subform.

I would like to get to know the flow conditions some more. Is there anywhere I can read about that ?

Regards
Soren
Reply
#6
Its pretty much the same as in a VCL forms app, except no forms are modal. Any .Show will return immediately.
Reply
#7
Soren, as Chad said no code executes a modal form inline. That's not just an IW behavior, it's a web behavior.

Servers respond to messages, execute some code to decide what to do, then return a message to the client browser when the code finishes. Then the server waits for the next message. In that regard it is different than VCL. Again, the server only updates the browser when the code (all of it in that round) finishes.

In the case of returning to your main form, the browser does not remember that form. Therefore the server must recreate the form and send it to the browser again.

It does take a little change of mindset on a couple of things, even though the behavior is VERY much like VCL in most regards. The web world just does not support all the things that Windows (or other rich clients) do.

Sorry if I'm not answering the question you have. Feel free to ask for more specific information.

Dan
Reply
#8
Hi Dan,

Thanks for your valuable input.

>>It does take a little change of mindset on a couple of things, even though the behavior is VERY much like VCL in most regards
Yes, that's the point and where my memory have tricked me. 10 years ago I created a web application using Delphi 2007 for .net, and it was exactly like that, but too much VCL programming since have made me forget it again. I need to get back into that line of thinking :-)

Regards
Soren
Reply
#9
Hi Dan,

Trying to figure this non-modal issue out in a clever way, I need a little guiding:

In the non-modal environment, any lines in the procedure after the form.create.show, will be executed right away but only acting on data before the form.create. And at the end of the procedure, the calling form is terminated. As far as I understand it, the calling form, will be reactivated, as if it was just launched, once the called form terminates.

As such, the purpose of UserSession is (among others I presume) to keep values between page refreshes, and can be used to pass data between forms. I take it, the Usersession form, is NOT refreshed during the life of an application. But if I initialize values in it as part of the launch of the mainform, I'll need to know that I've done that before, so that I do not overwrite any data from before, being passed between forms.

Are the any preferred ways of doing that ?
Reply
#10
You can do updates in the render/show events, or have callbacks when you release another form.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)