Re: Tabindex major trouble by NiklasRingdahl
NiklasRingdahl
Fri Mar 11 11:55:04 CST 2005
Saurabh,
The GIS program I am using is ArcMap from ESRI, and you are right, it is
Win32 based.
I think you are right also in the handling of navigation, because I set up a
test project that I ran as an independent exe, and these troubles never
occured. That can also explain a strange behaviour that I noticed: In both my
projects I added code in the KeyPress event for one control, to print the
pressed KeyCode. In the exe, all keys but Tab showed up in the Output panel,
whereas the form contained in ArcMap printed the Tab key as well. As if it
was just another button.
So, if I get this straight, the problem is that my contained code doesn't
understand that the Tab key press implies a navigation command? It just looks
at it as another keystroke?
In between looking at forums for answers I tried to implement my own
navigation using GetNextControl and got pretty far until I noticed too many
if's and but's on the way. As I see it, even if I hijack the windows message,
I would still have to implement my own navigation, right?
If so, can't I as well just look at KeyPress event?
If not, is there some way to tell the system to navigate to the next
control, besides calling GetNextControl?
Again, thanks a lot for your time and effort.
- Niklas
"Saurabh" wrote:
> Right Niklas,
>
> I assume that your GIS program is a Win32 application. In fact I am fairly
> sure that it is a Win32 application. This means that it is running its own
> message loop. Your form gets shown against that application meaning your
> ..NET forms do not have their own message loop.
>
> The tabkey navigation is implemented differently in .NET from Win32. If you
> use spy++ to see the classes of your controls, you will notive that in the
> old Win32 classes, the tab key will work as you have rightly pointed out
> about the combobox, and It will not work in the .NET classes.
>
> You can hook into the parent application using Windows API and hijack the
> messageloop of the parent GIS application. Then you can use the Windows API
> "IsDialogMessage" to interpret it in your winform.
>
> Other option is, You can run your application in a separate thread so that
> your forms get their own message loop and the tab key navigation will work.
>
> Let me know if you need any further information.
>
> --Saurabh
>
> "Niklas Ringdahl" <NiklasRingdahl@discussions.microsoft.com> wrote in
> message news:84FDE735-4AC4-4C35-B8B9-E6919B8269F2@microsoft.com...
> > Thanks Saurabh for looking into this.
> >
> > I don't know what more I can specify without sending you a ton of classes
> > and a GIS program with a license cost of $20 000...
> >
> > What I can tell you is that my combo boxes are of the type "DropDownList",
> > but one of them I mistakenly set to "DropDown", and that one reacted
> > correctly to the Tab press. We have overridden some events in our
> > inherited
> > controls, but in all of them we call base.OnEvent(e) before or after our
> > added code.
> >
> > Is there any specific info that could help you getting an idea on this? I
> > am
> > most willing to supply you with answers to anything.
> >
> > Thanks.
> > - Niklas
> >
> >
> > "Saurabh" wrote:
> >
> >> If you are saying that your dialog is shown against another application
> >> then
> >> there could be issues. Moreover the tabkey navigation on dialogs is
> >> differen
> >> in Win32 and .NET applications. If your parent application is a Win32
> >> application, the translation of tab into a navigation command is not sent
> >> to
> >> your dialog and it simply will not work.
> >>
> >> There is a possible workaround but it will never work a 100% if your
> >> dialog
> >> uses tab control because the tab control pages are now children whereas
> >> in
> >> old Win32 days they used to be siblings of the control... so on and so
> >> forth... If you could let me know your exact scenario, I may be able to
> >> help.
> >>
> >> Regards,
> >>
> >> --Saurabh
> >>
> >> "Niklas Ringdahl" <NiklasRingdahl@discussions.microsoft.com> wrote in
> >> message news:153F659D-C6B7-488E-9F40-DD91ADAF98F5@microsoft.com...
> >> > Hmm, maybe I was a bit short.
> >> >
> >> > I have a third party GIS program that acts as the users main program.
> >> > Within
> >> > that, a button of ours is clicked and the button instantiates the class
> >> > where
> >> > the form object resides. The form is initialized with some functions we
> >> > wrote, and then shown with this.Show();
> >> >
> >> > So the form is modeless in the sense that it will always be visible on
> >> > top
> >> > of the GIS program, but the user doesn't have to close the form to use
> >> > the
> >> > GIS program.
> >> >
> >> > Thank you
> >> > - Niklas
> >> >
> >> >
> >> > "Saurabh" wrote:
> >> >
> >> >> Is the form being shown as a dialog against some other window? If yes
> >> >> is
> >> >> it
> >> >> modal or modeless ?
> >> >> "Niklas Ringdahl" <NiklasRingdahl@discussions.microsoft.com> wrote in
> >> >> message news:8FB69003-C255-49C8-9437-2DEF36C4D445@microsoft.com...
> >> >> > Hello.
> >> >> >
> >> >> > I have a form with a tab control with some tabpages. On each of the
> >> >> > tabpages
> >> >> > I have separate user controls. The user controls constist of labels,
> >> >> > textboxes, combo boxes and datagrids.
> >> >> >
> >> >> > The problem is that I can't move focus between the input controls
> >> >> > with
> >> >> > the
> >> >> > tab button. At all. All my controls have the TabStop property set to
> >> >> > True,
> >> >> > and have a positive number.
> >> >> >
> >> >> > The form is inherited from a form which in turn is inherited from a
> >> >> > windows
> >> >> > form. All of the controls I use are my own, inherited from windows
> >> >> > controls.
> >> >> >
> >> >> > What could possibly be wrong? Where should I look?
> >> >> >
> >> >> > Thanks
> >> >> > - Niklas
> >> >> >
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>