'-- ตัวอย่างการสร้าง popup Menu และ MainMenu ภายในโปรแกรม 
$APPTYPE   GUI
$TYPECHECK ON
$ESCAPECHARS ON

DIM Form AS QFORM
	DIM Main AS QMainMenu
		DIM itemMedit AS QMenuItem
		DIM itemMdelete AS QMenuItem
		DIM itemMselall AS QMenuItem
	DIM Box AS QRICHEDIT
	DIM popBox AS QPOPUPMENU
		DIM itemPdelete AS QMenuItem
		DIM itemPline AS QMenuItem
		DIM itemPselall AS QMenuItem

' - - - - - - - - - - - - - - - - - - - - EVENT - - - - - - - - - - - - - - - - - - - - ' 

SUB DeleteText
	Box.SelText = ""
END SUB

SUB SelectText
	Box.SelectAll
END SUB

' - - - - - - - - - - - - - - - - - - - - PROPERTY - - - - - - - - - - - - - - - - - - - - ' 
with Form
.Caption = "PopupMenu And MainMenu Example"
.Width = 390:.Height = 300:.Center
end with
	with Main:.Parent = Form
	.Additems itemMedit
	end with
		with itemMedit '-- ไม่ต้องกำหนด Parent 
		.Caption = "&Edit"
		.Additems itemMdelete, itemMselall
		end with
			with itemMdelete
			.Caption = "&Delete"
			.onClick = DeleteText
			end with
			with itemMselall
			.Caption = "Select &All"
			.onClick = SelectText
			end with
	with Box:.Parent = Form
	.Align = 5 ' (alClient) 
	.Text = "ทดสอบ popup menu โดยการคลิ้กเมาส์ขวา"
	.PopupMenu = popBox
	end with
		with popBox '-- ไม่ต้องกำหนด Parent 
		.Additems itemPdelete, itemPselall
		end with
			with itemPdelete
			.Caption = "&Delete"
			.onClick =DeleteText
			end with
			with itemPline
			.Caption = "-"
			end with
			with itemPselall
			.Caption = "Select &All"
			.onClick = SelectText
			end with


' - - - - - - - - - - - - - - - - - - - - DISPLAY - - - - - - - - - - - - - - - - - - - - ' 
Form.SHOWMODAL