Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.

Same ContextMenu on different Controls

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-22-2009, 02:09 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default Same ContextMenu on different Controls

This is a small example, using the Door library, to manage a same ContextMenu on different Controls.

The request comes from the German forum on how to get the Control name from where the ContextMenu was triggered.

I think this could be usefull for others.

Best regards.
Attached Files
File Type: sbp TestContextMenu.sbp (2.3 KB, 110 views)
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #2 (permalink)  
Old 09-09-2010, 11:59 AM
Knows the basics
 
Join Date: Apr 2007
Location: Slovakia, Martin
Posts: 51
Send a message via ICQ to PatrikL Send a message via Skype™ to PatrikL
Default

Hi klaus,

thanx for this sample program. I try it, but doesnt work on realtime designed componets. For designer placed object works fine. Can me explain why?
__________________
Sirus Samsung Omnia i8000 WM6.5
Basic4PPC 6.90
Reply With Quote
  #3 (permalink)  
Old 09-09-2010, 12:47 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

What's the problem ?
See the attached program, works OK with controls added at runtime.

Best regards.
Attached Files
File Type: sbp TestContextMenu1.sbp (3.3 KB, 25 views)
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #4 (permalink)  
Old 09-13-2010, 06:55 AM
Knows the basics
 
Join Date: Apr 2007
Location: Slovakia, Martin
Posts: 51
Send a message via ICQ to PatrikL Send a message via Skype™ to PatrikL
Default

Hi Klaus,

thanks for reply. Your demo works fine. I attach part of my prog, which dont work. Please check it (if You want) and say me why.

Thanks.
Attached Files
File Type: sbp panell.sbp (4.9 KB, 22 views)
__________________
Sirus Samsung Omnia i8000 WM6.5
Basic4PPC 6.90
Reply With Quote
  #5 (permalink)  
Old 09-13-2010, 07:44 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

I tried your program, works fine on my desktop (IDE and compiled) and on my devices (autoscale compiled) (Qtek9090 WM2003, htc HD WM6.1.
So, could you explain what doesn't work.

- do you get an error ?
- are the context menus not displayed ?
- are the context menus not working ?
- etc

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #6 (permalink)  
Old 09-13-2010, 09:53 AM
Knows the basics
 
Join Date: Apr 2007
Location: Slovakia, Martin
Posts: 51
Send a message via ICQ to PatrikL Send a message via Skype™ to PatrikL
Default

I run program in IDE for now.

After start shows only panel with scrollbar. Then You must call context menu and select Add Text. On newly created textbox again You must call context menu and select first item. Then program shows messagebox. In this messagebox should be name of textbox which is owner of context menu. But doesnt show nothing.
__________________
Sirus Samsung Omnia i8000 WM6.5
Basic4PPC 6.90
Reply With Quote
  #7 (permalink)  
Old 09-13-2010, 11:47 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

It is doing exactly what you have programmed it to to - displaying any text that has been typed into the textbox
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #8 (permalink)  
Old 09-13-2010, 12:07 PM
Knows the basics
 
Join Date: Apr 2007
Location: Slovakia, Martin
Posts: 51
Send a message via ICQ to PatrikL Send a message via Skype™ to PatrikL
Default

In contextmenu click sub is code for giving name of textboxt which call context menu.

Sub cmtext_Click
'Dim Source
cmtextobj2.Value=cmtext.Value
cmtextobj1.Value=cmtextobj2.GetProperty("SourceCon trol")
Source=cmtextobj1.GetProperty("Text")
Msgbox(Source)
End Sub

According klaus demo program, this code show owner of context menu. In klaus demo program works fine. But not in my program. I cant understand why my code dont work (its same code as klaus code).
__________________
Sirus Samsung Omnia i8000 WM6.5
Basic4PPC 6.90
Reply With Quote
  #9 (permalink)  
Old 09-13-2010, 12:45 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by PatrikL View Post
According klaus demo program, this code show owner of context menu..
Klaus' program is returning the text property of the owner control which just happens to be the name of the control in his demo. If you type into your textbox then use the context menu you will see the text you have typed.

To get the name try

Source=cmtextobj1.GetProperty("propName")

This will only work on Basic4ppc intrinsic controls, not those added from a library.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #10 (permalink)  
Old 09-13-2010, 01:00 PM
Knows the basics
 
Join Date: Apr 2007
Location: Slovakia, Martin
Posts: 51
Send a message via ICQ to PatrikL Send a message via Skype™ to PatrikL
Default

Thanx a lot.

Works finally.

Btw. I search in
ContextMenu.SourceControl Property (System.Windows.Forms)

for properties "Text" or "propsname". I cant find nothing about that. Exist any better documentation?

P.S. agraham please look here http://www.basic4ppc.com/forum/quest...box-event.html and help solve also this my problem.
__________________
Sirus Samsung Omnia i8000 WM6.5
Basic4PPC 6.90

Last edited by PatrikL : 09-13-2010 at 01:04 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
ContextMenu and center button long press N1c0_ds Questions (Windows Mobile) 1 11-03-2008 03:56 AM
COM controls lairdre Questions (Windows Mobile) 3 02-28-2008 08:53 AM
Controls name PepSoft Questions (Windows Mobile) 4 12-17-2007 02:49 PM
ListView and contextmenu magi6162 Questions (Windows Mobile) 2 09-20-2007 07:15 AM
Listview mit ContextMenu Filippo German Forum 2 09-17-2007 09:30 PM


All times are GMT. The time now is 10:25 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0