PDA

View Full Version : About Popup Menu issue?


pierre
04-20-2004, 07:11 AM
Hi all:
I have some codes as below:
-- Show a popup menu at the coordinates of a lable object called "Label1"
tblPos = Label.GetPos("Label1");
tblSize =Label.GetSize("Label1");

x = tblPos.X;
y = tblPos.Y + tblSize.Height;

tblMenu =
{
{text="Apple",type=0,checked=false,enabled=true},
{text="Orange",type=0,checked=false,enabled=true},
{text="Pear",type=0,checked=false,enabled=true},
{text="Banana",type=0,checked=false,enabled=true},
{text="SEP",type=1,checked=false,enabled=true},
{text="Mango",type=0,checked=true,enabled=true},
{text="Pineapple (Not Available)",type=0,
checked=false,enabled=false}
};

strSelected = PopupMenu.Show(tblMenu,x,y,
PopupMenu.HALIGN_LEFT,PopupMenu.VALIGN_TOP);

if (strSelected ~= "CANCELLED") then
Dialog.Message("Selected Fruit",strSelected);
end

I had installed the Popup Menu plugin.

When I review these codes, it will show "attempt to index global 'tbPos' (a nil value).

How can I modify upon codes that it reaches my purpose? Who can help me solve the issue ASAP? Thank you for advance.

Brett
04-20-2004, 07:17 AM
Do you have a label object on your page called Label1? If not, that is why the table is empty...

rhosk
04-20-2004, 07:18 AM
Hi Pierre,

Do you have a Label Object named "Label1" on your page? If not, establish this object, then try your code again. Be sure to put this Label Object where you want the popup menu to appear.

Brett, you beat me to the punch again.

Worm
04-20-2004, 07:26 AM
"attempt to index global 'tbPos' (a nil value).

Is this typo part of your post or is it in your code? Your reference tbPos above, but in the code you posted you use tblPos

rhosk
04-20-2004, 07:29 AM
I'm guessing typo, cause that code is verbatim in the popup menu sample.

Worm
04-20-2004, 07:32 AM
I'm guessing typo, cause that code is verbatim in the popup menu sample.

I've got to get me that there plugin so's I kin keep up!

rhosk
04-20-2004, 07:38 AM
Oh, I like that plugin lots, but it could stand more customization features (hint, hint). Depending on what you want to apply it to though, it works perfectly.

Still waiting for that right-click option though. Can't wait for the "Free" upgrade :D

pierre
04-20-2004, 08:20 AM
Thank everyone. In fact, I lost a label, after adding a label object,its function is normal. Thank you again.