code:
Break On
$Form = CreateObject("Kixtart.Form")
$Form.Size = 400, 400
$Form.Center
$Form.ForeColor = Blue
$Form.OnMouseDown = "OnFormMouseDown"
$Form.Show
WHILE $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1
FUNCTION OnFormMouseDown
Dim $Menu,$Item
$Menu = "New","Open","Save","Save as...","Exit"
If $Form.MouseButton = 2 ; Right-click
$Item = popup($Form.Left + $Form.MouseX, $Form.Top + $Form.MouseY,$menu)
?"Item=" $Item
ENDIF
EndFunction
function popup($x,$y,$dataarray)
dim $o_popup, $dataaray, $x, $y, $i, $objectdata, $width, $lastwidth, $oldobject, $top, $close
$o_popup = createobject("Kixtart.form")
$o_popup.border = 0
$o_popup.location = $x,$y
$blue = $o_popup.rgb(50,0,238)
$black = $o_popup.rgb(0,0,0)
$close = $o_popup.label("X",0,0,0,0)
$close.width = $close.width
$close.onmouseover = "o_popupmouseover($$dataarray,-1,$$black,$$black)"
$close.onclick = "$$o_popup=0 $$popup=-1"
for $i = 0 to ubound($dataarray)
$objectdata = $dataarray[$i]
if $i > 0
$oldobject = $i-1
$ = execute("$$top = $$$oldobject.height + $$top")
else
$top = $close.height
endif
$ = execute('$$$i = $$o_popup.label($$objectdata,0,0,0,0)')
$ = execute("$$$i.top=$$top")
$ = execute("$$$i.width = $$$i.width+5")
$ = execute("$$$i.onmousemove = 'o_popupmouseover($$$dataarray,$$i,$$blue,$$black)'")
$ = execute("$$$i.onclick = '$$$$popup = $i $$$$o_popup=0'")
$ = execute("$$width = $$$i.width")
if $width > $lastwidth
$lastwidth = $width+6
endif
if $i = ubound($dataarray)
$ = execute("$$top = $top+$$$i.height+($$$i.height/2)")
endif
next
$o_popup.height = $top
$o_popup.width = $lastwidth
$close.left = $lastwidth - $close.width-10
$o_popup.show
While $o_popup.Visible
$=Execute($o_popup.DoEvents())
Loop
endfunction
function o_popupMouseOver($array,$pointer,$oncolor, $offcolor)
for $i = 0 to ubound($array)
if $i = $pointer
$ = execute("$$$i.forecolor = $$blue")
else
$ = execute("$$$i.forecolor = $$black")
endif
next
endfunction