Context Menu - Pop-Up

Blitz3D Forums/Blitz3D Programming/Context Menu - Pop-Up

Is it possible to create a context / pop-up menu in blitz 3D -- for example, when you click on an object it will pop-up some sort of menu of possible choices?

Any thoughts, tips, samples, links, etc. appreciated!

Thanks.

You can try our system BCF 3.0, it's GUI for Blitz3D

http://www.3dgametool.com/project_bcf3.htm

XlntGui can do that aswell - thats what i use :P
www.xlnt.co.uk

Hmm... but with these GUI libs, can you do a pop-up menu or other without opening a window?

I want it so the user right clicks on a 3D object, and a pop-up menu appears right at their mouse cursor, already popped-up, and they just move the mouse to their choice, and let go...

Ok, after reading some, I see in xlnt that you can use quick menus which pops-up if you right click, but is it possible to pop-up for other types of clicks like left click, etc.?

If yes possible to create a coneptual menu whith windows, go and download the demo :-)

Hey SSzretter,
I think I almost have a solution to this, I'll try and get it to work :)

OK, here it is:
SetBuffer BackBuffer()
Local items$[50]
items[0]="Exit"
items[1]="Return"
items[2]="Start"
items[3]="Wombatify"
items[4]="Forty-two"
items[5]="Shrubbery"

While action<>1
Cls

If MouseHit(2)
action=PopupMenu(MouseX(),MouseY(),items,6)
EndIf
Delay 10
Flip
Wend


;*******************************
;**	Function PopupMenu()	****

;**Parameters:
;x: the x coordinate of the upper left corner of the menu
;y: the y coordinate of the upper left corner of the menu
;item$[50]: the text of the menuitems. Must be a 50-member blitzarray
;num: the number of menuitems. can be up to 50

;return value: the index of the menuitem selected, starting from 1
;if no item is selected, it returns 0

Function PopupMenu%(x,y,item$[50],num)
Local width=0,temp
Local gw=GraphicsWidth(),gh=GraphicsHeight()
If num>50 Return 0

For i=0 To num-1
temp=StringWidth(item[i])
If temp>width width=temp
Next



temp=CreateImage(gw,gh)
CopyRect 0,0,gw,gh,0,0,GraphicsBuffer(),ImageBuffer(temp)

Repeat
Cls

DrawImage temp,0,0

my=(MouseY()-y)/FontHeight()
If my<num And (MouseX()>x And MouseX()<x+width)
pos=my
Else
pos=-1
EndIf


For i=0 To num-1
Color 255,255,255
Rect x-1,y+(i*FontHeight())-1,width+5,FontHeight()+2,1
Color 0,0,0
Rect x-1,y+(i*FontHeight())-1,width+5,FontHeight()+2,0
Text x,y+(i*FontHeight()),item[i]
Next

Flip
Delay 10

Until MouseHit(1)

Cls
DrawImage temp,0,0
FreeImage temp
Return pos+1
End Function


Far from optimized, let me know of any bugs or features you want :)

Very nice electronin, thank you.