"Right click"...

B

baramuse

Hi all

I know there isn't real right clicks on mobile devices as there is no
mouse...
But, I want to reproduce it, as windows CE does when it draws a circle
around the cursor, when there is a "long click", to show a popup context
menu (again as windowsCE does).

Is there someway to use the "windows functionnality" or will I have to
code it myself (with per example an timestamp between the MouseDown and
the MouseUp event...)

I've looked for solutions around the web and on this newsgroup but it's
hard to find good keywords for a notion that does not exists ("right
click" ;))

Thanks in advance
 
B

baramuse

Pete said:
Hi,
you need to attach a context menu to whatever control you are holding the
stylus down on ('right clicking')

HTH

Pete

hum, that's what I did though....

ctor{
....
this.m_cm = new ContextMenu();
this.m_cm.Popup+=new EventHandler(m_cm_Popup);

this.ContextMenu = this.m_cm;
this.Click+=new EventHandler(PanelQuestionnaireCheckBox_Click);
this.MouseUp+=new MouseEventHandler(PanelQuestionnaireCheckBox_MouseUp);
this.MouseDown+=new MouseEventHandler(PanelQuestionnaireCheckBox_MouseDown);
}

private void m_cm_Popup(object sender, EventArgs e)
{
MenuItem m = new MenuItem();
m.Text = "Saisir un commentaire";
m.Click+=new EventHandler(OnSaisieCommentaireClick);
m_cm.MenuItems.Add(m);

m = new MenuItem();
m.Text = "Saisir une alerte";
m.Click+=new EventHandler(OnSaisieAlerteClick);
m_cm.MenuItems.Add(m);
}
 
P

Pete Vickers [eMVP]

Hi,
add a contextmenu control to your form, and add your menus to it. Then
simply change the contextmenu property of the control you wish to use to
contain the name of the context menu. You can do this at design time

Pete

--
Pete Vickers
Microsoft Windows Embedded MVP
HP Business Partner
http://www.gui-innovations.com

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
B

baramuse

Pete said:
Hi,
add a contextmenu control to your form, and add your menus to it. Then
simply change the contextmenu property of the control you wish to use to
contain the name of the context menu. You can do this at design time

Pete

okay and then use the SourceControl propriety in the popup event to
build the correct menu ?
 
B

baramuse

Pete said:
Hi,
add a contextmenu control to your form, and add your menus to it. Then
simply change the contextmenu property of the control you wish to use to
contain the name of the context menu. You can do this at design time

Pete

hum there is no SourceControl propriety in CF....
and the actions on the menu must have a "link" with the control that
"popuped" the context menu :/
 
P

Pete Vickers [eMVP]

Hi,
which control are you trying to add a context menu to. Most controls have a
contextmenu property.
e.g. add a contextmenu control to your form, and add 1 menu to it. Then add
a button control. In the properties for the button, click on 'contextmenu'
and it should show you the contextmenu you have just added. Select that.

When you run your code, tap and hold the button, and the context menu will
appear



Pete


--
Pete Vickers
Microsoft Windows Embedded MVP
HP Business Partner
http://www.gui-innovations.com

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
B

baramuse

Pete said:
Hi,
which control are you trying to add a context menu to. Most controls have a
contextmenu property.
e.g. add a contextmenu control to your form, and add 1 menu to it. Then add
a button control. In the properties for the button, click on 'contextmenu'
and it should show you the contextmenu you have just added. Select that.

When you run your code, tap and hold the button, and the context menu will
appear



Pete

The control is a CustumControl derivated from Control class.
Basicly a panel with other vars...

this "custumpanel" is added to other custumpanels contained by the main
form (I'm developping a multipanel-singleform application)

So the control does have the ContextMenu property but nothing happens
when I tap-and-hold (finally find the "word" to define that lol)

I'm running on WindowsCE 4.2 with CF SP2 (humm I think i'll check if
it's spé..)
 

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