Click to See Complete Forum and Search --> : Problem with Dialog box


ramu
August 9th, 1999, 07:21 AM
Hai friends,
I have doubt working with JDialog box.I am using model less dialog box. I have a progressbar and a button on the dialog box.I am setting the value of the progress bar in for loop. when i click the button the a flag is set. with this flag i want to break the loop.But my problem is i couldn't fire event on the button.Please help me.

unicman
August 9th, 1999, 07:55 AM
Even if u press the button, event is not generated. Is this what u mean?

I also think that the event will not get fired at all. The reason is, even if the dialog-box is modeless, u should be out of any sub-routine for the event to occur. What happens is u r doing all the operation at the background. So it doesn't come out of the sub-routine. So events doesn't occur. I had the same problem.

Actually in case of modeless dialog, it will allow operations made on the background frame. If u want that when this dialog appears, any operations on the frame shouldn't be allowed, u have to make it modal. I hope u r getting what I want to say.

When I had to create a progress dialog, I had created modal dialog-box. And then I had done all the processing in different thread. The sequence I had used is...

1. Instantiate the dialog
2. Start the thread in which I do all the operations
3. Show the dialog-box with 'show' method.

If u agree with my strategy, try using it.

- UnicMan
http://members.tripod.com/unicman

August 10th, 1999, 06:13 AM
Hai Mr Manish,
Thanks for responding for my doubt.
I understood what you explained. But i cannot use threads for this problem.
Is there any other way to solve this problem.( other then dialog box)

unicman
August 10th, 1999, 09:01 AM
I don't think so.

I think whether or not ur dialog is modal, u have to return from the sub-routine after 'show' is called. Otherwise events will not get generated. So the only way I think is to have a thread doing all the processing parallelly.

- UnicMan
http://members.tripod.com/unicman