Event Processing Puzzle

I'm posting this on the remote chance that somebody else run into this problem:

I'm printing something from my program. Before sending the data to the
printer, I show a little preview window with a "Print" and "Cancel"
buttons.
If "Print" is pressed, the user is prompted to select the printer.

The problem is that after the user selects the printer (any printer)
and clicks Print, the dialog dissapears and NOTHING HAPPENS.
The user has to click some more inside the interface before the small
"Printing" dialog appears.

I think I'm doing something wrong inside one of my event handlers...
Something the "Printing" dialog appears after I close the program window.

Any idea is welcomed.

Unfortunately I cannot isolate the problem in a small sample, but the
printing code (custom printout) was imported from another place where
it works beautifully.

Thank you in advance.
Peter

···

--
There is NO FATE, we are the creators.

Peter Damoc wrote:

I'm posting this on the remote chance that somebody else run into this problem:

I'm printing something from my program. Before sending the data to the
printer, I show a little preview window with a "Print" and "Cancel"
buttons.
If "Print" is pressed, the user is prompted to select the printer.

The problem is that after the user selects the printer (any printer)
and clicks Print, the dialog dissapears and NOTHING HAPPENS.
The user has to click some more inside the interface before the small
"Printing" dialog appears.

I think I'm doing something wrong inside one of my event handlers...
Something the "Printing" dialog appears after I close the program window.

Any idea is welcomed.

Unfortunately I cannot isolate the problem in a small sample, but the
printing code (custom printout) was imported from another place where
it works beautifully.

All I can suggest at this point is to start from the original code you copied from and add relevant bits from your current app until it starts having the same problem. That will help isolate the source of the problem and then a work around will probably be able to be figured out.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks Robin,

I did try to comment things out and I isolated the faulty code inside
a drawing method.
Inside this method the code is split in multiple methods.
Unfortunately I still don't understand what's happening.

The main effect is that some wx internal commands stop working, or
better said, are executed later, after the drawing code changes.
The drawing code gets called from an OnPaint handler that keeps
getting activated by a OnTimer handler via Refresh.
When I do some clicking that changes the set of drawing code, the "not
working" bits of code get executed.

So far I isolated 2 relevant bits of code:
1. The part that displays "Printing" /"Please wait while printing"
small dialog.
2. Closing of the frame.
Both get triggered ONLY after I switch the drawing code (the switch is
done after a mouse event)

The close event is very weird. I left the default handler run because
I didn't needed any processing on close BUT when I saw that the frame
wouldn't close, I mounted an OnClose handler that just calls
frame.Destroy(). The handler gets called (I put a print statement and
I saw output) BUT the frame only closes when I switch the drawing
code.

Another weird thing is that this doesn't happen when the custom Panel
is placed inside a wx.Dialog.

I'm now digging through the drawing code.... If I discover something
interesting... I will post it here...

Thank you again.
Peter

···

On Wed, Oct 8, 2008 at 2:38 AM, Robin Dunn <robin@alldunn.com> wrote:

Peter Damoc wrote:

I'm posting this on the remote chance that somebody else run into this
problem:

I'm printing something from my program. Before sending the data to the
printer, I show a little preview window with a "Print" and "Cancel"
buttons.
If "Print" is pressed, the user is prompted to select the printer.

The problem is that after the user selects the printer (any printer)
and clicks Print, the dialog dissapears and NOTHING HAPPENS.
The user has to click some more inside the interface before the small
"Printing" dialog appears.

I think I'm doing something wrong inside one of my event handlers...
Something the "Printing" dialog appears after I close the program window.

Any idea is welcomed.

Unfortunately I cannot isolate the problem in a small sample, but the
printing code (custom printout) was imported from another place where
it works beautifully.

All I can suggest at this point is to start from the original code you
copied from and add relevant bits from your current app until it starts
having the same problem. That will help isolate the source of the problem
and then a work around will probably be able to be figured out.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

--
There is NO FATE, we are the creators.