Page 1 of 1
Form: isModal - does anyone know how to do this?
Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by Anonymous >> Mon, 7 May 2007 2:55:35 GMT
I need to determine at run time whether or not a form is modal.
Other languages support 'isModal'. Anyone know of a way to achieve this in Jade?
Re: Form: isModal - does anyone know how to do this?
Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by Brendan >> Mon, 7 May 2007 8:43:55 GMT
One way is as follows. Ensure all forms are defined as a subform of Baseform and define a property isModal : Boolean on Baseform. Then reimplement showModal on Baseform to be
begin
isModal := true;
return inheritMethod();
end;
Brendan
Re: Form: isModal - does anyone know how to do this?
Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by Alan >> Mon, 7 May 2007 10:05:13 GMT
What if the forms are already defined - alot of hassle to move them?
Re: Form: isModal - does anyone know how to do this?
Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by Brendan >> Mon, 7 May 2007 10:42:17 GMT
Indeed. You may have a lot of hassle in this case. If you don't want to rearrange the form hierarchy, you could define an abstract method isModal(): Boolean on Form and add a Boolean property modalForm on all immediate subclasses of Form. Then, on each of these immediate subclasses, re-implement isModal to return modalForm and also reimplement showModal as before (but obviously setting modalForm not isModal to true).
If your Form hierarchy isn't arranged with a Baseform superclass for all forms, it may be time well spent rearranging the hierarchy this way anyway for many other benefits. I would strongly recommend this. This change for isModal would then be trivial and having this hierarchy can simplify many other situations.
Cheers, Brendan
Re: Form: isModal - does anyone know how to do this?
Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by
Allistar >> Tue, 8 May 2007 2:47:57 GMT
You may find the GetWindowLong function will help. Reference for it is here:
http://msdn2.microsoft.com/en-us/library/ms633584.aspx
Either the styles or extended style should provide you this information. Creating an external function call for this is pretty straight forward.
Regards,
Allistar.
Re: Form: isModal - does anyone know how to do this?
Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by Scott >> Wed, 9 May 2007 4:54:04 GMT
Why form care modal or not modal?
Re: Form: isModal - does anyone know how to do this?
Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by Alan >> Wed, 9 May 2007 10:22:27 GMT
The same form could be used for maintenance (non-modal) or selection of values to be supplied to other forms (modal). Obviously easy enough to set flag when to indicate this but would be useful for this (and potentially other reasons) to dynamically know.
Re: isModal - does anyone know how to do this?
Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by Darrell Duniam >> Thu, 31 May 2007 3:54:03 GMT
Could you set the "modalResult" property to a non-zero value before you show the form, and then interrogate the property once the form has been shown ?
darrell.