|
-
Modal or Modeless
Is there an API that can determine how a form has been loaded?
IE: Form1.Show vbModal
On Form1 a Command button that would be clickable and tell you that the form
was loaded Moadlly or Modeless?
Gary
-
Re: Modal or Modeless
I don't know of any magical way to know that a form was created modally or
modeless. However, it's easy enough to keep track of this in your own
application. Just add a property to the form that you set before showing it to
indicate what mode you used when you called the Show command.
Dan
Gary Staunton wrote:
> Is there an API that can determine how a form has been loaded?
>
> IE: Form1.Show vbModal
>
> On Form1 a Command button that would be clickable and tell you that the form
> was loaded Moadlly or Modeless?
>
> Gary
-
Re: Modal or Modeless
Thanks for the info Dan.
I just thought that there would be a simple API call as Windows does know
if the form is loaded either way.
Gary
Dan Appleman <dan@desaware.com> wrote:
>I don't know of any magical way to know that a form was created modally
or
>modeless. However, it's easy enough to keep track of this in your own
>application. Just add a property to the form that you set before showing
it to
>indicate what mode you used when you called the Show command.
>
>Dan
>
>
>Gary Staunton wrote:
>
>> Is there an API that can determine how a form has been loaded?
>>
>> IE: Form1.Show vbModal
>>
>> On Form1 a Command button that would be clickable and tell you that the
form
>> was loaded Moadlly or Modeless?
>>
>> Gary
>
-
Re: Modal or Modeless
You would think so, wouldn't you?
Sometimes things don't make a whole lot of sense:-)
Dan
Gary Staunton wrote:
> Thanks for the info Dan.
>
> I just thought that there would be a simple API call as Windows does know
> if the form is loaded either way.
>
> Gary
>
> Dan Appleman <dan@desaware.com> wrote:
> >I don't know of any magical way to know that a form was created modally
> or
> >modeless. However, it's easy enough to keep track of this in your own
> >application. Just add a property to the form that you set before showing
> it to
> >indicate what mode you used when you called the Show command.
> >
> >Dan
> >
> >
> >Gary Staunton wrote:
> >
> >> Is there an API that can determine how a form has been loaded?
> >>
> >> IE: Form1.Show vbModal
> >>
> >> On Form1 a Command button that would be clickable and tell you that the
> form
> >> was loaded Moadlly or Modeless?
> >>
> >> Gary
> >
-
Re: Modal or Modeless
> I just thought that there would be a simple API call as
> Windows does know if the form is loaded either way.
Gary: I don't think Windows does know. If you use Spy++ to examine the
properties of a modal window, you'll find that there's nothing to
distinguish it from a non-modal one. I'm pretty sure that when you show a
form modally, Windows simply disables all other top-level windows in the
application.
An alternative solution, which avoids the need to explicitly set a property
before showing the form, is to create a drop-in replacement for the .Show
method (e.g., .ShowForm) and call it instead of the standard method:
Public Sub ShowForm(Optional Modal As _
FormShowConstants = vbModeless, _
Optional OwnerForm As Object)
' Save modality in module-level variable
m_bModal = CBool(Modal)
' Show the form
If OwnerForm Is Nothing Then
Me.Show Modal
Else
Me.Show Modal, OwnerForm
End If
End Sub
---
Phil Weber
-
Re: Modal or Modeless
"Phil Weber" <pweber@teleport.com> wrote:
> > I just thought that there would be a simple API call as
> > Windows does know if the form is loaded either way.
>
>Gary: I don't think Windows does know. If you use Spy++ to examine the
>properties of a modal window, you'll find that there's nothing to
>distinguish it from a non-modal one. I'm pretty sure that when you show
a
>form modally, Windows simply disables all other top-level windows in the
>application.
Windows must know, because when the form is unloaded the other windows become
enabled again.
Or else VB knows, and VB is the one showing the window modally by telling
windows to disable the other forms in the App.
Matthew Cromer
Similar Threads
-
By Shiva Prasad in forum VB Classic
Replies: 0
Last Post: 01-10-2002, 08:54 AM
-
By Shiva Prasad in forum VB Classic
Replies: 0
Last Post: 01-10-2002, 08:54 AM
-
By Hans Larsen in forum Web
Replies: 0
Last Post: 03-16-2001, 12:31 PM
-
By LThib in forum VB Classic
Replies: 0
Last Post: 11-13-2000, 03:52 PM
-
By LThib in forum VB Classic
Replies: 0
Last Post: 11-13-2000, 03:52 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks