473,320 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

A GOTCHA! to avoid with Modal Forms

I recently discovered an interesting aspect of Forms which are launched as
modal forms via ShowDialog.

As it turns out, if the modal form is visible and its Hide( ) method is
performed it actually fires the Close( ) event. This makes sense, since a
modal form only allows further execution of code past the line the launched
it when it goes away. Hence, hiding it is the same as it goes away, since
hiding it would 'kidnap' the application ala it's being modal, and thus
calls close.

However, one should also note that Close( ) doesn't actually close the form,
but Hide( )'s it! That's so it can be used immediately without setting it
up again (thus very fast).

So, to re-cap (in an unrigorous way), Hide( ) becomes Close( ), and they
both just do Hide( ), but they both call the Close handler.

The reason this caught me by surprise is that I had created a special Close
event handler that exited the entire program after fading, and was a bit
shocked at first to find my program exiting when I just hid the modal form!
FYI, I corrected by deriving a new Form class from the standard one that
changed the Close handler to reject closing (i.e., e->Cancel = true). Now it
just hides the modal form when it is hidden!
Nov 13 '07 #1
0 856

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kenneth Porter | last post by:
Posting this for posterity and for googlers looking for solutions to this problem. I upgraded PHP on my Fedora Linux server to 4.3.10 due to the recent security issue and phpMyAdmin stopped...
6
by: Ed Schofield | last post by:
Hi all, I find this strange: >>> flist = >>> for i in range(3): .... f = lambda x: x+i .... flist.append(f) .... >>>
3
by: Frank Bechmann | last post by:
Eventually most of you will not learn much from this because it's just another event in the 'default argument value gotcha' series, but because it cost me some hours yesterday to spot this 'error'...
2
by: Ed Schofield | last post by:
Hi all, This interested me: >>> a1 = a2 = {} >>> a1 = 1 >>> a2 {'blah': 1} >>> a1 == a2 True
1
by: Ellen K. | last post by:
I made a database to hold recordings of calls made to our customers. When I made it I set the size of the primary datafile to 18GB. It's been running flawlessly for over 10 months. A few days...
0
by: Yin99 | last post by:
Do the TableAdapters have any limitations, gotcha's, or anything that may bite ya in the rear down the road? I'm looking for lessons learned and/or past experience. I'm starting a new...
3
by: vbgunz | last post by:
forgive me for my bumbling confusion. I am learning javascript and got caught up in a gotcha. this may be due to Mozillas spidermonkey or most likely to my n00b mindset on how encodeURI* and...
16
by: Hendrik van Rooyen | last post by:
I thought I would share this nasty little gotcha with the group. Consider the following code fragment: <start> print 'starting kbd thread' keyboard_thread = thread.start_new_thread(kbd_driver...
14
by: Hendrik van Rooyen | last post by:
Hi, I am surprised that it took me so long to bloody my nose on this one. It must be well known - and I would like to find out how well known. So here is a CLOSED BOOK multiple choice...
5
by: cnb | last post by:
this recursive definition of sum thrumped me, is this some sort of gotcha or am I just braindead today? and yes i know this is easy a a for x in xs acc += x or just using the builtin. def...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.