PopupModal()


moose2004

Recommended Posts

I have a login popup box(PhoneNumberPassword) to allow a user to type in a hard coded password. If it matches I want the PhoneNumberPassword to close and then open a different popup page. It is not working ...why? On the login page I have a button that calls the following sequence...

private string password = component.password_phone.strContents

if(password == 'mypassword')

component.password_phone.strContents = ""

page.PhoneNumberPassword.ClosePopup()

page.PhoneSetup.PopupModal(1) // This is not working!?

else

system.MessageBox('Incorrect Password!')

component.password_phone.strContents = ""

endif

It seems that I cant close a popup and open another back to back even if I put a delay in there.

Any ideas?

Link to comment
Share on other sites

1) there can only be one popup open at once

2) popups are open and closed asynchronously through the UI thread which allows them to be manipulated from sequence threads running in the background. This means that doing ClosePopup() and then PopupModal() won't work because the ClosePopup() doesn't actually close the popup, it simply tells the system to close the popup the next time around the UI loop, so the popup isn't closed by the time popupModal() is called. Adding delay() might work if this code was in a sequence, but since its in a button event, and therefore running in the UI thread, it won't help because the UI loop is stalled waiting for your code to run.

Solution: use a sequence to popup the second popup. The sequence would be something like:

delay(2)

page.PhoneSetup.PopupModal(1)

And then in your event code, replace the popupModal() line with beginseq(mysequence). Leave the closePopup in your event.

Link to comment
Share on other sites

  • 2 years later...

I have some similar code to moose2004

Password entry box with a button and submit action and a quick sequence action see below:

 

As Moose above , I try to erase the password using the strcontents property for the component.

What I find is that contents of the edit box get set to "" every other time 2nd time I call the popup,

else it stays as the last (correct) password  as entered.

 

Any Ideas?

 

delay(1)
if(Prod_Admin_Password == APword)
   component.Admin_Password.strContents=""
   delay(2)
   page.Prod_Admin_Password.ClosePopup()
   Page.strCurrentPage="Main_Admin"
   else
    system.MessageBox("invalid.Password")
   endif

 

Not sure how the actions are executed , Action 1 is submit, Action 2 is this script. The initial delay is to ensure submit is carried out before this script runs - probably not necessary.

Link to comment
Share on other sites

The actions execute in order, but submit won't affect the edit box.  You never want to put delay() directly in the action of a screen component as it will make DAQFactory appear hung for the duration of the delay.  This is because the action runs in the user interface thread.  If you need to do something that takes time, or needs delays, you should create a sequence and start the sequence from the button press.

 

I'm not exactly sure why it does that, but its easy to get around.  Create a sequence that looks like this.  Call it "clearPassword"  (call it what you like, but I'm calling it that!)

 

delay(1)

component.admin_password.strContents = ""

 

Then change your component action script to:

 

if(Prod_Admin_Password == APword)
   page.Prod_Admin_Password.ClosePopup()
   Page.strCurrentPage="Main_Admin"

   beginseq(clearPassword)
else
    system.MessageBox("invalid.Password")
endif

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.