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 > Additional Libraries
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Additional Libraries Users contributed libraries.
This sub-forum is only available to licensed users.

MiniMenu.dll, a context menu for the device.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-22-2009, 06:41 PM
taximania's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire. UK
Posts: 592
Awards Showcase
Beta Tester 
Total Awards: 1
Default MiniMenu.dll, a context menu for the device.

I know that FormLib.dll has a contextmenu in it,
But this is short and neat and may be of interest to someone.

mini.New1("?")
'?' is any object in your app. Form1, Label1, Textbox1 etc.

The contextmenu has 3 items in it.
The default text for the items can be read or changed by
the relevant mini.Item'x'text method.

sub mini_PopUp is fired before the menu is displayed,
but after the menu has been initiated, 'right click or
stylus touch on the 'control' defined in the New1("?")

Hence the use of the timer1 in the Sub mini_PopUp

If a menu item is not clicked,
mini.RespText returns the string "null"
mini.RespValue returns the int 0

If the menu is clicked,
mini.RespText returns the 'preset' or 'set' text for the Item
mini.RespValue returns the 'preset' Int for item, 1 - 3.



Code:
Sub Globals
    
'Declare the global variables here.
End Sub

Sub App_Start
    Form1.Show
    mini.New1(
"Form1")
End Sub

Sub mini_PopUp
timer1.Interval=
2000
timer1.Enabled=
True
End Sub

Sub Timer1_Tick
timer1.Enabled=
False
Msgbox(mini.RespText,mini.RespValue)
End Sub
Ive added the .dll, .sbp source example and the Class1.cs C# file.

@whoever knows, how do I get the MenuItem.Click event to work
Attached Files
File Type: zip miniMenu.zip (2.8 KB, 34 views)
__________________
.
.
.
Don't ask, I'm fine, honest. !!
.
.
.
Just a little crazy at times



O2 XDA, GW Evo 2.1 UC WWE Rom, WM6.1
Radio Ver 03.34.90
With Basic4ppc V6.80


http://www.taximania.co.uk

Last edited by taximania : 02-23-2009 at 07:01 PM.
Reply With Quote
  #2 (permalink)  
Old 02-23-2009, 11:48 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

Get rid of that timer! I haven't run this but it looks OK to me. I put an extra txt extension as I couldn't be bothered to zip it.
Attached Files
File Type: txt Class1.cs.txt (4.0 KB, 14 views)
Reply With Quote
  #3 (permalink)  
Old 02-23-2009, 07:32 PM
taximania's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire. UK
Posts: 592
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Timer gone, many thanks AGraham, new working lib in 1st post.

'sub mini_Click' now returns the selected menu item.

Edit: As an afterthought, the mini_Popup event is still triggered before the menuitem
options are shown. I'll leave it there for now. You don't have to use it.
At least you have the option to know a menu item can be selected before it actually is ;-)

Now for the biggie >> ?? Watch this space
__________________
.
.
.
Don't ask, I'm fine, honest. !!
.
.
.
Just a little crazy at times



O2 XDA, GW Evo 2.1 UC WWE Rom, WM6.1
Radio Ver 03.34.90
With Basic4ppc V6.80


http://www.taximania.co.uk

Last edited by taximania : 02-23-2009 at 07:55 PM.
Reply With Quote
  #4 (permalink)  
Old 02-23-2009, 08:08 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 taximania View Post
At least you have the option to know a menu item can be selected before it actually is .
It's better than that. In the Popup event you can change the menu item text, add new menu items etc. It is an opportunity to tailor the context menu to the present situation rather than having to do it pre-emptively in advance.
Reply With Quote
  #5 (permalink)  
Old 02-24-2009, 06:01 PM
taximania's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire. UK
Posts: 592
Awards Showcase
Beta Tester 
Total Awards: 1
Default

I've just realised the code you translated for me doesn't use the
Show(this, contextmenu bla bla bla) bit of code.
I'm sure it existed in my original code, what fires the menu to display ?

I haven't got a copy of my original code to look what I had wrote !
I overwrote? it with your working code
__________________
.
.
.
Don't ask, I'm fine, honest. !!
.
.
.
Just a little crazy at times



O2 XDA, GW Evo 2.1 UC WWE Rom, WM6.1
Radio Ver 03.34.90
With Basic4ppc V6.80


http://www.taximania.co.uk
Reply With Quote
  #6 (permalink)  
Old 02-24-2009, 06:19 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 taximania View Post
I'm sure it existed in my original code
You did have the following but I removed it as it did nothing because you hadn't added it to the Form MouseDown event and it's not needed anyway.
Code:
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
    
if (e.Button == MouseButtons.Right)
    {
        mnu.Show(frm, new Point(e.X, e.Y));
    }
}
Quote:
what fires the menu to display?
The users' right click, you just get called along the way as long as you have added the events. Show lets you display a ContextMenu by other means, such as a button press, if you want to.
Quote:
haven't got a copy of my original code to look what I had wrote !
I overwrote? it with your working code
Tut!
Reply With Quote
  #7 (permalink)  
Old 02-24-2009, 06:44 PM
taximania's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire. UK
Posts: 592
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Tut!

Now that's a lesson for all of us. Save a copy of your code if it partially works or not.
__________________
.
.
.
Don't ask, I'm fine, honest. !!
.
.
.
Just a little crazy at times



O2 XDA, GW Evo 2.1 UC WWE Rom, WM6.1
Radio Ver 03.34.90
With Basic4ppc V6.80


http://www.taximania.co.uk
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
new context menu Event Cableguy Basic4ppc Wishlist 1 11-12-2008 12:09 AM
Need for context menu francisco cobos Questions (Windows Mobile) 6 03-05-2008 02:33 PM
Context Menu name change klaus Questions (Windows Mobile) 2 12-26-2007 12:18 PM
Context Menu X,Y coordinates evaklim Questions (Windows Mobile) 1 10-16-2007 01:04 PM
Controls and Context menu magi6162 Questions (Windows Mobile) 1 09-10-2007 08:56 AM


All times are GMT. The time now is 06:45 AM.


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