Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-09-01
9
Medium Priority
?
422 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
[X]
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
  • 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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 2000 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

688 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