Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Oct 20, 2018 11:04 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Movable Modal Window behavior
PostPosted: Sat Oct 01, 2005 10:03 am 
Offline

Joined: Fri Sep 30, 2005 8:24 am
Posts: 25
Location: Turin, Italy
I know you can load and show a window simply setting a property. So, if you write inside window1:
window2.title = "my_title"

window2 is showed (with my_title, obviously).
I also want to close window1. So my code is:
window2.title = "my_title"
self.close

If the windows are Document window, window2 is showed and window1 is closed. But if the windows are Movable Modal, they are both closed.
Is this the normal behavior or a bug?
It happens only on win32.
RB 2005r3, OSX 10.4.2, Win2000

Thanks
Fabio Soggia


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 10:31 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 8:05 am
Posts: 61
Location: Edinburgh, Scotland
You should explicitly open the window. Don't expect it to appear when you give it a title.

_________________
Charlie Boisseau
[ My Site | My Blog | Net Tool Box ]


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 10:37 am 
Offline

Joined: Fri Sep 30, 2005 8:24 am
Posts: 25
Location: Turin, Italy
Charlie Boisseau wrote:
You should explicitly open the window. Don't expect it to appear when you give it a title.

Have you tried the code and above all your solution? Because it doesn't work.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 10:44 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 8:05 am
Posts: 61
Location: Edinburgh, Scotland
No, but I have run into problems when not being explicit with opening and closing windows.

_________________
Charlie Boisseau
[ My Site | My Blog | Net Tool Box ]


Top
 Profile  
Reply with quote  
 Post subject: Re: Movable Modal Window behavior
PostPosted: Sat Oct 01, 2005 10:47 am 
Offline
User avatar

Joined: Wed Sep 28, 2005 8:39 am
Posts: 9341
Location: St Augusta, MN
fabio.soggia wrote:
I know you can load and show a window simply setting a property. So, if you write inside window1:
window2.title = "my_title"

window2 is showed (with my_title, obviously).


Which is considered bad form because it can lead to hard to track down bugs in your application. You should use explicit instansiation whenever possible.

Quote:
I also want to close window1. So my code is:
window2.title = "my_title"
self.close

If the windows are Document window, window2 is showed and window1 is closed. But if the windows are Movable Modal, they are both closed.
Is this the normal behavior or a bug?


Yes, that's exactly what should happen. Window2 is owned by Window1, and since it's a dialog, it cannot exist without its parent. So when Window1 is closed, Window2 is closed as well.


Top
 Profile  
Reply with quote  
 Post subject: Re: Movable Modal Window behavior
PostPosted: Sat Oct 01, 2005 10:53 am 
Offline

Joined: Fri Sep 30, 2005 8:24 am
Posts: 25
Location: Turin, Italy
Aaron Ballman wrote:
Yes, that's exactly what should happen. Window2 is owned by Window1, and since it's a dialog, it cannot exist without its parent. So when Window1 is closed, Window2 is closed as well.

Is this only for win32? Osx seems working different.
Dialog are all the windows that are not Document windows?
Thanks


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 10:57 am 
Offline
User avatar

Joined: Wed Sep 28, 2005 8:39 am
Posts: 9341
Location: St Augusta, MN
Basically, yes -- dialogs are just about anything that's not a Document window. And yes, the behavior may be different from OS to OS. This is the standard behavior on Windows, so we follow it there so that you don't get into trouble with Windows users for having "strangely behaving" applications.

What's the reason for using a moveable modal in the first place, if I may ask? Perhaps there's a better solution.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 11:12 am 
Offline

Joined: Fri Sep 30, 2005 8:24 am
Posts: 25
Location: Turin, Italy
Aaron Ballman wrote:
What's the reason for using a moveable modal in the first place, if I may ask? Perhaps there's a better solution.

There is a document behind, I was just trying to isolate the problem in a separete project. Osx was ok, w32 worked different.
There is more code than that I posted, but that was essential to reproduce the behavior I didn't understand.
I found that I have to close the 1st window before open the 2nd, and in this way it works equal (probably because so window2 is owned by document behind).
Thanks for your explanation


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 11:14 am 
Offline
User avatar

Joined: Wed Sep 28, 2005 8:39 am
Posts: 9341
Location: St Augusta, MN
Correct, the parent is chosen automatically for you, and glad to hear it's working for you now!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 11:19 am 
Offline
User avatar

Joined: Wed Sep 28, 2005 8:39 am
Posts: 9341
Location: St Augusta, MN
Oh yeah, and I should note -- another problem with the code you posted is that the window isn't getting true dialog behavior in some regards because you're using implicit instansiation.

Window2.Title = "la la la"


is the same as saying

dim w as new Window2
w.Title = "la la la"
w.Show


Did you spot the bug? What you *want* to have happen with dialogs is:

dim w as new Window2
w.Title = "la la la"
w.ShowModal // or ShowModalWithin


Otherwise you don't get the modality that you should. Bad mojo, I say! Always use explicit instansiation, it will save you a LOT of time in the long run.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 11:19 am 
Offline

Joined: Fri Sep 30, 2005 8:24 am
Posts: 25
Location: Turin, Italy
Aaron Ballman wrote:
Correct, the parent is chosen automatically for you, and glad to hear it's working for you now!

I'm more glad :D


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 11:26 am 
Offline

Joined: Fri Sep 30, 2005 8:24 am
Posts: 25
Location: Turin, Italy
Aaron Ballman wrote:
Always use explicit instansiation, it will save you a LOT of time in the long run.

If I understand correctly your message, I should use ShowModalWithin because so I could set the parent window, which could also be another window, and not the same where the code is.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 11:32 am 
Offline
User avatar

Joined: Wed Sep 28, 2005 8:39 am
Posts: 9341
Location: St Augusta, MN
Correct!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group