|
-
Jul 15th, 2006, 09:21 AM
#1
Thread Starter
Addicted Member
[2005] Make a function wait for an event before returning value
I was putting the finishing touches on my widget engine and I encountered a rather annoying problem. My engine has a custom MsgBox function which overrides the framework's msgbox function once the engine has been imported into a solution. To make a long story short, my msgbox function shows a 'widget' object which is the size of a msgbox and has buttons, text.. etcetera... One of the defining features of a msgbox, is that it stops whatever is currently processing and waits for the user to click a button. Now normally I would just use the showdialog function on my widget and use a with statement to detect when the dialogresult value has been set. The problem is, showdialog messes up the parent/child relationships of my widgets so I am forced to use show(), which does not produce a value. Therefore I will have to somehow force my MsgBox function to wait for the OnClick event of one of its buttons BEFORE returning a value. How can I do this? Multi-Threading?
help
-
Jul 15th, 2006, 10:40 AM
#2
Re: [2005] Make a function wait for an event before returning value
Is this for Yahoo widgets?
You could do many things, but that may lead to more complex solutions... maybe you should describe the parent child relationships.
-
Jul 15th, 2006, 10:41 AM
#3
Thread Starter
Addicted Member
Re: [2005] Make a function wait for an event before returning value
no its for my own widget engine that I made.... child objects are actually popup windows so the showdialog function screws them up
basically i need to figure out how to block the calling thread and wait for a form to close before resuming (emulate the showdialog function)
-
Jul 15th, 2006, 01:26 PM
#4
Thread Starter
Addicted Member
Re: [2005] Make a function wait for an event before returning value
i figured it out.... the startposition property of my main form was screwing things up... i just set it to manual and the children windows work with the showdialog function again
-
Jul 15th, 2006, 02:10 PM
#5
Re: [2005] Make a function wait for an event before returning value
VB Code:
Public Class Form1
Private SomeEventRaised As Boolean = False
Private Sub SomeOperation()
'code
While SomeEventRaised <> True
End While
'The event was raised, go on
End Sub
Private Sub EventHandler(ByVal sender As Object, ByVal e As System.EventArgs) Handles SomeObject.Event
SomeEventRaised = True
End Sub
End Class
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Feb 14th, 2007, 10:31 AM
#6
Thread Starter
Addicted Member
Re: [2005] Make a function wait for an event before returning value
..that makes it hang. I figured this out a while ago tho. Thx
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
|
Click Here to Expand Forum to Full Width
|