PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework How to find the active form in CF

Reply

How to find the active form in CF

 
Thread Tools Rate Thread
Old 09-09-2006, 03:11 PM   #1
Hari
Guest
 
Posts: n/a
Default How to find the active form in CF


Hi,
Can any one plz tell me how to know which form is active in an
application. My app contains many forms and requires to identify the
active form very frequently. I found that there is no property like
Form.ActiveForm available in CompactFramework. I could use a class
which contains a Form class variable to store the current form instance
and assign to it the current form instance in the page_load event of
that form. But this may lead to bugs if i fail to assign the correct
form instance. So i prefer a more direct way. Plz help!

- Hari

  Reply With Quote
Old 10-09-2006, 10:39 AM   #2
Simon Hart
Guest
 
Posts: n/a
Default Re: How to find the active form in CF

Have you looked at the SNAPI (State Notification API) for Windows Mobile 5
if you are using it. I can't remeber off the top of my head whether the
functionality you require is available in SNAPI.

Alternaively, have you considered creating a base form to which each form
derives which handles this global variable?

Regards
Simon.

"Hari" <hadusumalli@mantragroup.com> wrote in message
news:1157811077.536962.51800@h48g2000cwc.googlegroups.com...
> Hi,
> Can any one plz tell me how to know which form is active in an
> application. My app contains many forms and requires to identify the
> active form very frequently. I found that there is no property like
> Form.ActiveForm available in CompactFramework. I could use a class
> which contains a Form class variable to store the current form instance
> and assign to it the current form instance in the page_load event of
> that form. But this may lead to bugs if i fail to assign the correct
> form instance. So i prefer a more direct way. Plz help!
>
> - Hari
>



  Reply With Quote
Old 11-09-2006, 08:16 AM   #3
Hari
Guest
 
Posts: n/a
Default Re: How to find the active form in CF

Hi Simon,
Actually i'm not aware of SNAPI. I'm developing the app. using
..Net Compact Framwork and the language as C#. And regarding your second
suggestion, is it not similar to the way i've done. I've used a class
which is meant for holding the instance of the current form and i'm
setting that instance in the page_load event of every form. I think
this is almost similar to deriving from a base form which holds the
form instance as you said. Is it any different. Any other suggestion?
Thanks for the help.

- Hari
Simon Hart wrote:
> Have you looked at the SNAPI (State Notification API) for Windows Mobile 5
> if you are using it. I can't remeber off the top of my head whether the
> functionality you require is available in SNAPI.
>
> Alternaively, have you considered creating a base form to which each form
> derives which handles this global variable?
>
> Regards
> Simon.
>
> "Hari" <hadusumalli@mantragroup.com> wrote in message
> news:1157811077.536962.51800@h48g2000cwc.googlegroups.com...
> > Hi,
> > Can any one plz tell me how to know which form is active in an
> > application. My app contains many forms and requires to identify the
> > active form very frequently. I found that there is no property like
> > Form.ActiveForm available in CompactFramework. I could use a class
> > which contains a Form class variable to store the current form instance
> > and assign to it the current form instance in the page_load event of
> > that form. But this may lead to bugs if i fail to assign the correct
> > form instance. So i prefer a more direct way. Plz help!
> >
> > - Hari
> >


  Reply With Quote
Old 11-09-2006, 08:58 AM   #4
Peter Foot [MVP]
Guest
 
Posts: n/a
Default Re: How to find the active form in CF

The managed equivalent of SNAPI is the Microsoft.WindowsMobile.Status
namespace. Take a look at the SystemState.ActiveApplication which may help
although I believe it only stores the names of separate application windows
and not forms within a single application.

Peter

--
Peter Foot
Device Application Development MVP
www.peterfoot.net | www.inthehand.com

"Hari" <hadusumalli@mantragroup.com> wrote in message
news:1157958995.702471.291100@e3g2000cwe.googlegroups.com...
> Hi Simon,
> Actually i'm not aware of SNAPI. I'm developing the app. using
> .Net Compact Framwork and the language as C#. And regarding your second
> suggestion, is it not similar to the way i've done. I've used a class
> which is meant for holding the instance of the current form and i'm
> setting that instance in the page_load event of every form. I think
> this is almost similar to deriving from a base form which holds the
> form instance as you said. Is it any different. Any other suggestion?
> Thanks for the help.
>
> - Hari
> Simon Hart wrote:
>> Have you looked at the SNAPI (State Notification API) for Windows Mobile
>> 5
>> if you are using it. I can't remeber off the top of my head whether the
>> functionality you require is available in SNAPI.
>>
>> Alternaively, have you considered creating a base form to which each form
>> derives which handles this global variable?
>>
>> Regards
>> Simon.
>>
>> "Hari" <hadusumalli@mantragroup.com> wrote in message
>> news:1157811077.536962.51800@h48g2000cwc.googlegroups.com...
>> > Hi,
>> > Can any one plz tell me how to know which form is active in an
>> > application. My app contains many forms and requires to identify the
>> > active form very frequently. I found that there is no property like
>> > Form.ActiveForm available in CompactFramework. I could use a class
>> > which contains a Form class variable to store the current form instance
>> > and assign to it the current form instance in the page_load event of
>> > that form. But this may lead to bugs if i fail to assign the correct
>> > form instance. So i prefer a more direct way. Plz help!
>> >
>> > - Hari
>> >

>



  Reply With Quote
Old 16-09-2006, 10:54 AM   #5
Simon Hart
Guest
 
Posts: n/a
Default Re: How to find the active form in CF

It is not the same though is it because you are having to remember to set
this variable in each form (page_load delegate).
If you were to derive from a form, this class would handle this variable so
you would not have to remember to set it in each form you create.

Regards
Simon.

"Hari" <hadusumalli@mantragroup.com> wrote in message
news:1157958995.702471.291100@e3g2000cwe.googlegroups.com...
> Hi Simon,
> Actually i'm not aware of SNAPI. I'm developing the app. using
> .Net Compact Framwork and the language as C#. And regarding your second
> suggestion, is it not similar to the way i've done. I've used a class
> which is meant for holding the instance of the current form and i'm
> setting that instance in the page_load event of every form. I think
> this is almost similar to deriving from a base form which holds the
> form instance as you said. Is it any different. Any other suggestion?
> Thanks for the help.
>
> - Hari
> Simon Hart wrote:
>> Have you looked at the SNAPI (State Notification API) for Windows Mobile
>> 5
>> if you are using it. I can't remeber off the top of my head whether the
>> functionality you require is available in SNAPI.
>>
>> Alternaively, have you considered creating a base form to which each form
>> derives which handles this global variable?
>>
>> Regards
>> Simon.
>>
>> "Hari" <hadusumalli@mantragroup.com> wrote in message
>> news:1157811077.536962.51800@h48g2000cwc.googlegroups.com...
>> > Hi,
>> > Can any one plz tell me how to know which form is active in an
>> > application. My app contains many forms and requires to identify the
>> > active form very frequently. I found that there is no property like
>> > Form.ActiveForm available in CompactFramework. I could use a class
>> > which contains a Form class variable to store the current form instance
>> > and assign to it the current form instance in the page_load event of
>> > that form. But this may lead to bugs if i fail to assign the correct
>> > form instance. So i prefer a more direct way. Plz help!
>> >
>> > - Hari
>> >

>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off