![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 7 of 7 total |
![]() |
Thu, Apr 4 2019 11:14 AM | Permanent Link |
D.C. | Hello,
I don't know if this is a bug or I'm doing something wrong. If I have a form not autocreated, and instantiate it on runtime, if I assign a value to form's Tag or a public variable, they are cleared at form's show event: var frm: TMyForm; frm:=TMyForm.Create(Application); frm.Tag := 2; frm.ShowModal; If form's show event, Tag is 0. The same happens if I add a variable to the class definition of the form. Regards |
Thu, Apr 4 2019 11:36 AM | Permanent Link |
Walter Matte Tactical Business Corporation | Values delete might be an incorrect way of describing the problem.... I See the same thing.... it is not set before the OnShow but it is set .... just after.... but after the onshow (I put a button on the form to check) it is there. procedure TfrmInstruct.Button1Click(Sender: TObject); begin ShowMessage(inttostr(self.Tag)); end; It is not behavior I would expect. Walter |
Fri, Apr 5 2019 7:26 AM | Permanent Link |
D.C. | Thanks Walter,
My workaround is to have the form autocreated. But it will be nice to have the same behavior on runtime created forms. Perhaps there is another event before the form is available to use where I can read the value? Regards Diego |
Fri, Apr 5 2019 8:34 AM | Permanent Link |
Walter Matte Tactical Business Corporation | My workaround would be a timer in the onshow.
Walter |
Fri, Apr 5 2019 11:29 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | << If I have a form not autocreated, and instantiate it on runtime, if I assign a value to form's Tag or a public variable, they are cleared at form's show event: >>
They're not cleared, the assignment is just out-of-order with the actual form show. What's happening is this: 1) The form is created, and because it's Visible property is True, it's shown during creation, triggering the OnShow event handler. 2) The Tag property is then assigned a value, and the ShowModal method called. However, because the form is *already* visible, the OnShow *isn't* called the second time. Just make sure that the form's Visible property is set to False at design-time, and you should see the correct behavior. Tim Young Elevate Software www.elevatesoft.com |
Fri, Apr 5 2019 3:18 PM | Permanent Link |
ooptimum | I just want to add that this is also true for the onhide event handler. Thus just upon a form is created, one of the onshow or onhide triggers will fire instantly depending on the form's published visibility property value, even before form's constructor returns, if I remember it right. I had to develop a solution to distinguis this very first call of a visibility change handler in some my forms.
Just my 2 cents... |
Mon, Apr 8 2019 1:16 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | << I just want to add that this is also true for the onhide event handler. Thus just upon a form is created, one of the onshow or onhide triggers will fire instantly depending on the form's published visibility property value, even before form's constructor returns, if I remember it right. I had to develop a solution to distinguis this very first call of a visibility change handler in some my forms. >>
I might look into fixing this, because this is different from the OnShow behavior, which is typically something that the developer *wants* to occur. If I do fix it, there will be a note in the breaking changes section of the release notes for the release that corrects it. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Monday, May 29, 2023 at 11:23 AM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |