Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

showDialog() - what's going on when it is invoked?

Posted on 2004-09-01
9
417 Views
Last Modified: 2013-12-03

I have been using Forms - and therefore .showDialog() -  (in J++ - although I'm pretty sure this is just WinAPI stuff so applies equally from C++ or VBasic) for a long time but they seem to (mis)behave in seemingly strange ways from time to time - refusing to become visible once hidden, blocking when they shouldnt etc.

To shed light on this I would like to understand what happens (at a lower level) when showDialog() is invoked.

Also whats the difference between showDialog() and showDialog(anotherForm) and show() exactly.

A clear explaination would be appreciated - but also references to online sources (although I have yet to find anything that  explains this clearly)

0
Comment
Question by:flashdriver
  • 5
  • 2
9 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 11952555
>Also whats the difference between showDialog() and showDialog(anotherForm)

showDialog() Shows the form as a modal dialog box with no owner window
showDialog(anotherForm) Shows the form as a modal dialog with the specified owner (the top-level window that will own the modal dialog - 'anotherForm')
0
 
LVL 16

Expert Comment

by:nonubik
ID: 11952579
show() displays the control(for in this case) to the user. Showing the control is equivalent to setting the Visible property to true. After the Show method is called, the Visible property returns a value of true until the Hide method is called.

0
 

Author Comment

by:flashdriver
ID: 11955672
Yes but not what I meant.

What is going on at 'control' level.

When showDialog() is executed control blocks until the user exits to form ( or close() is executed, or dispose() - and are these the same btw) - so what happens to control in the meanwhile?

If I use a timer does it share the same thread (seems to).

What is the break down of what happens when showDialog() and close()n are issued?

0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 16

Expert Comment

by:nonubik
ID: 11961787
>When showDialog() is executed control blocks until the user exits to form

The dialog is displayed as modal. There are two kinds of dialog boxes:

Modal dialog boxes, which require the user to respond before continuing the program
Modeless dialog boxes, which stay on the screen and are available for use at any time but permit other user activities

>so what happens to control in the meanwhile?
The dialog stays in a message loop, DoModalLoop() until a closing message is sent (WM_CLOSE, WM_DESTROY, etc)

>If I use a timer does it share the same thread (seems to).
If the timer is set for your dialog, the WM_TIMER messages are treated inside the above message loop and passed to your handler (if any). So, the same window message loop (not necesarly the same thread).
0
 

Author Comment

by:flashdriver
ID: 11964416
Thanks - good start.

This is the level I need to understand.

How can I see what's going on and/or tap into the message process?

(I'm in J++)
0
 
LVL 16

Expert Comment

by:nonubik
ID: 11964456
I'm sorry I can't take you further, for I'm in C++ :)
But there (in VC++) you can put some breakpoints in the MFC CDialog class methods.
0
 
LVL 16

Accepted Solution

by:
nonubik earned 500 total points
ID: 11964501
But I think that in J++ you can, too, set a hook, with SetWindowsHookEx or something. In that way you can replace the dialog's wndproc and tap messages.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question