Modal window help

before I display a modal window, I copy some text to a string property (descriptionSelected) see code below,
in the open event of the window I copy the string property to the windows text area,
but nothing get’s displayed. if I copy some text in the window open event to the string property
and then to the text area, that’s working, what’s missing ?

dim iwComment As new wRowComment
iwComment.descriptionSelected = “blablabla” --> does not get displayed after open the window
iwComment.ShowModalWithin(wmain)

If you are going to set the property of the window each time you open it then why not create a Constructor method for the window:

Constructor(theBlurbToUse As String)
and put the following code in that constructor method

descriptionSelected = theBlurbToUse Super.Constructor
in the method where you are creating the window change your code to:

dim iwComment As new wRowComment("blablabla")

I just whipped up a small test app and you seem to be correct. The debugger shows that the text property in the second window does not contain the text put into it until after the Open event completes. I tested this by having a breakpoint in the Open event and in a pushbutton I put on the second window. The breakpoint in the Open event shows the property empty while the one in the Pushbutton shows the property with the text in it.

Interestingly, if instead of putting the text into a property you put it directly into the text display area, it shows up properly.

That is why the Constructor method is handy. You place the data into the fields and then invoke the Constructor of the Super class, the window in this case. Now the controls are built and the needed information is in place. Doing it the original way the Super.Constructor of the window is invoked at the time the “new wRowComment” is executed and so the information is not in place until after the controls are initiated. Just be sure to put the “Super.Constructor” line after setting the desired fields with the information passed to the Constructor that you created

Harrie, would you mind create a sample project on what u mention?

thank’s guys,

I tried it with the constructor version, it does not work either.
All I wanted was to pass some text to the window. is there another way to do it ?

The constructor should work. The problem with your original code is the Open event occurs before you set the string property.

dim iwComment As new wRowComment    // Open event happens here
iwComment.descriptionSelected = "blablabla"   // too late
iwComment.ShowModalWithin(wmain)

There are some issues with properties and when they get initialized to their default values. You may have to set the text in your constructor method after you call Super.Constructor, which unfortunately is also after the Open event will have already fired, so you may need to set the Text of the control directly in the Constructor.

yes, setting the text directly in the constructor works,
we are learning and learning

thanks Tim

one more question

how can I pass data back to the calling script ?

[quote=132915:@Johann JFK]before I display a modal window, I copy some text to a string property (descriptionSelected) see code below,
in the open event of the window I copy the string property to the windows text area,
but nothing get’s displayed. if I copy some text in the window open event to the string property
and then to the text area, that’s working, what’s missing ?

dim iwComment As new wRowComment
iwComment.descriptionSelected = “blablabla” --> does not get displayed after open the window
iwComment.ShowModalWithin(wmain)[/quote]

The issue here is that the Open event happens BEFORE you think it does

  1. dim iwComment As new wRowComment // <<<<< constructor & open events run
  2. iwComment.descriptionSelected = “blablabla” // <<<<<<<<<< NOW the property gets set

A constructor will fix that

As for how to pass data back you can write this code so it behave like a function
See http://www.great-white-software.com/REALbasic_Code.html
How to use a Dialog like a function

found it on the html page, exactly what I needed,

thanks Norman

Mr. Duke, I am an old retired guy and I don’t have a web site and don’t wish to utilize Dropbox for this, so, if you still would like an example just e-mail me at

harriew at frontiernet dot net

and I will fire you off an example that shows a Constructor method being used for a couple of different windows.