Which is the sequence of events when using ShowDialog()?

S

SammyBar

Hi all,

I'm having troubles with a Symbol 9000 device (Compact Framework v 1.1) when
activating the barcode scanner from a window. The problem is related to the
Activated event of the form which carries the task of the initializing the
scanner. It looks like this event is not called after the creation of one of
the forms. Let me describe shortly the sequence of form creation. The app
first call a browsing form by using ShowDialog(). This browsing form (modal
dialog) calls a data input form that uses the scanner device using
ShowDialog(). It works as expected. On the Activated event it captures the
scanning device and on Deactivate releases it. This forms is also a modal
dialog. From this data input I call a third data input form also by using
ShowDialog(). Note it is the third on the "stack" of called modal dialogs.
The Deactivate event is called for the second form and the scanner is
released, but the Activated event is not called for this third form then the
scanner is not activated. To get the Activated event called I should make a
trick: The three modal dialogs are represented on the taskbar as buttons. I
can click the button of the second form. It is displayed but is blocked for
input. But in this click the Deactivate event is called for the third form
and the Activated is called for the second. Then I click the button on the
taskbar for the third form and voila! the Activated event is called for the
first time for the third form, resulting in the scanner device being
activated. I should note that the handlers for these events are registered
in the Load event handler. The Load event handler is registered on
InitializeComponent as normally it is created from the Visual Studio 2005. I
fear the Activated event is called before the Load when the handler is not
registered yet.
What can be wrong? Which is the sequence of events when using ShowDialog()?

Any hint is welcomed
Thanks in advance
Sammy
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

In the dev kit of symbol you have a working sample of a scannining win app.
you can use it.

You just have to be careful with creating only one instance of the control.

I don't remember clearly now how I did it (I do not have the code with me)
but it was not that difficult.

You do not need to have a textbox focused.
Finally be careful with modal dialogs , if you get a orphan window you may
get into problem.

So in short, see the sample in the docs, it works perfectly !!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top