Showing a popup in a loop

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
MegumiSawada
Posts: 45
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

Showing a popup in a loop

Post by MegumiSawada » Tue Sep 06, 2016 12:25 pm

Hi,

I'm using VLWeb and I have a question regarding popup in Web page.
I would like to show popup every time in a loop, but now it only shows the popup at the last loop.
Is it possible to show the popup 3 times (for example, with the following code) in a loop?

Code: Select all

Mthroutine Name(LOOP)
Begin_Loop Using(#STD_NUM) To(3)
#Popup1.Caption := #STD_NUM.AsString
#Popup1.ShowPopup Placement(Center)
End_Loop
Endroutine
I appreciate your kind advice!

Best Regards,
Megumi

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Showing a popup in a loop

Post by Stewart Marshall » Tue Sep 06, 2016 1:12 pm

Hi Megumi

Unlike Forms, Popups can't be modal, so they don't stop the processing of the loop.

The only option is to show the popup and then to respond to the Closing event. Trying to show the popup again in the closing event is ignored because the popup is busy closing, so you'll need to use a timer so that it can be shown after the Closing event has finished

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB) Height(472) Width(889)

Define_Com Class(#PRIM_PHBN) Name(#Button1) Caption('Button1') DisplayPosition(1) Left(21) Parent(#COM_OWNER) TabPosition(1) Top(19)
Define_Com Class(#PRIM_PPNL) Name(#Popup1) CloseButton(True) Left(216) Parent(#COM_OWNER) TitleBar(True) Top(48) Height(286) Width(412) AutoClose(False)
Define_Com Class(#STD_NUM.Visual) Name(#STD_NUM) DisplayPosition(2) Left(24) Parent(#Popup1) TabPosition(2) Top(80) Height(29) ReadOnly(True)

Define_Com Class(#prim_timr) Name(#Timer) Interval(10) Startup(Manual)
Evtroutine Handling(#Button1.Click)

#STD_NUM := 1

Begin_Loop To(3)
#Popup1.ShowPopup Placement(Center)
End_Loop

Endroutine

Evtroutine Handling(#Popup1.Closing)

#Timer.Start

Endroutine

Evtroutine Handling(#Timer.Tick)

#Timer.Stop

If (#STD_NUM < 3)

#Popup1.ShowPopup Placement(Center)

#STD_NUM += 1

Endif

Endroutine

End_Com
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

MegumiSawada
Posts: 45
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

Re: Showing a popup in a loop

Post by MegumiSawada » Tue Sep 06, 2016 2:12 pm

Hi Stewart,

Thank you for your quick respond!!
I'll try it.

Best Regards,
Megumi

MegumiSawada
Posts: 45
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

Re: Showing a popup in a loop

Post by MegumiSawada » Wed Sep 07, 2016 7:18 pm

Hi Stewart,

Actually I would like to put button control on a popup in a loop and decide what to do next based on button click event.
But it seems that button click event in a loop cannot be detected correctly.
So I decided to use #SYS_WEB.Confirm instead of popup control(#SYS_WEB.Confirm works correctly in a loop).

However, from the following reasons, I would like to use popup control or other control rather than #SYS_WEB.Confirm.
- I don't want to show URL (on iPhone)
- I would like to wrap the message text at specified position
- I would like to set the specific color under the condition

Is there any better way which works correctly in a loop and to satisfy these points?

Best Regards,
Megumi Sawada

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Showing a popup in a loop

Post by Stewart Marshall » Thu Sep 08, 2016 5:39 pm

Hi Megumi

I've just posted a tip showing how "looping" can be managed with a popup

http://vlforum.lansa.com.au/viewtopic.php?f=4&t=182

Regards
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

Post Reply