![]() |
|
Problem to create a modal form - SOLVED - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: Problem to create a modal form - SOLVED (/thread-3358.html) Pages:
1
2
|
Problem to create a modal form - SOLVED - StephB - 07-05-2023 Dear all, I tries to add a modal form to my intraweb app and I don't understand what is my mistake. The structure of my app is : - a home page to display my records - a card template to design my records. Each card has a button to call the modal I need - optional, an additionnal form to manage the modal. I would like to use an external form to avoid having an instance of the modal in each card I have to create. For my modal, I tried to use a region inside my card or the optionnal additionnal modal form, and in each case the modal is created but it's empty. ![]() I tried to set the ContentElement programmatically or using the Object Inspector, same result. In the Object Inspector, I can select a component from my external form. ![]() But I can use the same syntax when I want to assigned it at runtime, I have to create an object first. Is it the correct way to do that ? This is the expected result : ![]() I attached a test case, hope somebody can have a look on it and help me to understand how i have to design this. Regards, Stéphane RE: Problem to create a modal form - Alexandre Machado - 07-07-2023 Hi Stéphane, I'll run your test case and get back to you on this ASAP RE: Problem to create a modal form - StephB - 07-07-2023 Thank you RE: Problem to create a modal form - Alexandre Machado - 07-13-2023 I checked your project and IW doesn't currently support that type of construction. The Object inspector shows all containers as possible candidates to be linked as a ContentElement, but at runtime the region parented to another form can't be used in a different form host. If you create the TIWFormModal at runtime (as shows the code in your test case that has been commented out) it will become the active form and you won't be seeing the old form on the browser anymore. You can make it work correctly if you make it a frame instead of an IWform. In that case you must create the IWFrame at runtime and set the content element to the IWRegion on the frame RE: Problem to create a modal form - StephB - 07-13-2023 Thank you for your advice, works fine with a frame AND after I include the region used for the modal to my HTML template. RE: Problem to create a modal form - Alexandre Machado - 07-25-2023 Great, thanks for the feedback RE: Problem to create a modal form - StephB - 08-01-2023 Dear all, Back again after few week without working on my project cause I have another problem with my modal. Thanks to Alexandre, the render of the modal is what I want, but it doesn't work as expected and I don't understand why. My testcase modal contains an IWEdit with data type stDate, an IWButton and an IWLabel. On AsyncClick on the button, the selected date must be displayed in the label. But when I test my modal, on click, the IWEdit text is always empty, so my label (or my variable in my real project) is empty. I putted a breakpoint in my event, it's reached on click, but the IWEdit text is empty. ![]() For comparison, I created the same set of components (IWEdit, IWButton and IWLabel) on my home page, and in this case the IWEdit text is properly copied on click on the button. ![]() I don't understand the difference between the 2 cases and why my IWEdit is empty in my procedure even if I have a value selected in my modal. I tried with a IWEdit with data type stText, I have the same wrong result. I already tried to use OnClick event instead of OnAsyncClick, but no chnage. I also tried to encapsulate my 3 items in a form tag instead of a div and to assign manually the type submit to my button. In this case, when I select a date and press the button, the breakpoint is not reached and the modal is reset. At this moment, if I select another date and press the button again, the breakpoint is reached and the IWEdit text is available in my procedure. But not acceptable, I can't ask my user to do the job 2 times. Hereby I join a new verson of my testcase, hope somebody can help me to understand what is the problem. Many thanks for your help. RE: Problem to create a modal form - Alexandre Machado - 08-03-2023 Hi Stéphane, I'll have a look and get back to you ASAP. Cheers, RE: Problem to create a modal form - Alexandre Machado - 08-04-2023 Hi Stéphane, This was a tough one. There is a bug when there are multiple levels of frames like this. We have already fixed the bug so the fix will be available in the next release. There is an easy workaround for you, while the fix is not available: After creating the IWModalCard you can notify the owner form directly that there was a change (i.e. you have created a control youself), doing: IWForm.RehashPending := True; In your project you don't have direct access to the parent main form, however you can obtain it using the owner of the TIWFrameCard itself. So it would be like: Code: usesPlease have in mind that after the update this workaround is redundant and should be removed. Cheers RE: Problem to create a modal form - StephB - 08-04-2023 Hi Alexandre, Thank you for your proposal, but the workaround doesn't work for me, I always need to select and validate my date 2 times, the first try doesn't run the event. I tried with (Self.Owner is TIWForm) and (Self.Owner is TIWAppForm), but no change. The instruction RehashPending := True is reached in both case, so the problem doesn't come from the IF statement. Do you have an estimated date of availability for the next release ? I can keep this point open for few weeks I think, I have a lot of other features to dev and test in my app, and i can use a form instead of a modal at the beginning, if no other solution. Have a nice end of day and a nice week-end. Stéphane |