oform = CREATEOBJECT('tform') WITH oform oform.grdtestt.column1.header1.caption = "Name" oform.grdtestt.column2.header1.caption = "Age" ENDWITH oform.show() read events return DEFINE CLASS tform AS form DataSession = 1 Top = 0 Left = 0 Height = 241 Width = 726 DoCreate = .T. Caption = "Right Click on any name in the listbox." BindControls = .T. cvalue = ("") Name = "Form1" ADD OBJECT list1 AS listbox WITH ; FontBold = .F., ; FontName = "Arial", ; FontSize = 9, ; ColumnCount = 2, ; ColumnWidths = "220,100", ; RowSourceType = 6, ; RowSource = "cname, cage", ; ControlSource = "thisform.cvalue", ; Enabled = .T., ; Height = 199, ; ColumnLines = .F., ; Left = 12, ; SpecialEffect = 0, ; TabIndex = 1, ; Top = 5, ; Width = 384, ; ReleaseErase = .F., ; ColorSource = 4, ; BoundTo = .T., ; Name = "list1" ADD OBJECT cmdclose AS commandbutton WITH ; Top = 211, ; Left = 300, ; Height = 27, ; Width = 84, ; Caption = "Close", ; Name = "cmdclose" ADD OBJECT grdtestt AS grid WITH ; ColumnCount = 2, ; Height = 200, ; Left = 407, ; Panel = 1, ; ReadOnly = .T., ; RecordSource = "testt", ; RecordSourceType = 1, ; Top = 5, ; Width = 312, ; Name = "grdTestt", ; Column1.ControlSource = "testt.cname", ; Column1.Width = 223, ; Column1.ReadOnly = .T., ; Column1.Name = "Column1", ; Column2.ControlSource = "testt.cage", ; Column2.ReadOnly = .T., ; Column2.Name = "Column2" PROCEDURE Unload IF USED('testt') USE IN testt ENDIF DODEFAULT() ENDPROC PROCEDURE Load IF USED('testt') USE IN testt ENDIF IF FILE('testt.dbf') DELETE FILE ('testt.dbf') ENDIF IF !FILE('testt.dbf') sele 0 set safety off CREATE TABLE testt (cname c(30), cage c(3), city c(20), state c(2)) SELE testt APPEND BLANK REPLACE cname WITH "John Jones" REPLACE cage WITH "30" REPLACE city WITH "Fayetteville" REPLACE state WITH "NC" APPEND BLANK REPLACE cname WITH "Stacy Wellington" REPLACE cage WITH "22" REPLACE city WITH "New York" REPLACE state WITH "NY" APPEND BLANK REPLACE cname WITH "Peggy Lipton" REPLACE cage WITH "12" REPLACE city WITH "FLorence" REPLACE state WITH "SC" ELSE SELE 0 USE testt ENDIF GO top DODEFAULT() ENDPROC PROCEDURE Init IF !USED('testt') return .f. ENDIF DODEFAULT() SELE testt GO top thisform.cvalue = testt.cname thisform.list1.requery() thisform.list1.refresh() thisform.list1.listindex = 1 ENDPROC PROCEDURE Destroy CLEAR EVENTS DODEFAULT() ENDPROC PROCEDURE list1.InteractiveChange DODEFAULT() thisform.cvalue = testt.cname thisform.Refresh ENDPROC PROCEDURE list1.DblClick wait window alltrim(testt.cname)+", "+alltrim(testt.city)+", "+testt.state nowait ENDPROC PROCEDURE list1.RightClick Define POPUP shortcut shortcut IN WINDOW (thisform.name) MARGIN FROM MROW(), MCOL() Define BAR 1 OF shortcut PROMPT "\<Show City" FONT 'Arial', 9 style "T" DEFINE BAR 2 OF shortcut PROMPT "\<Show State" FONT 'Arial', 9 STYLE "T" On SELECTION BAR 1 OF shortcut wait window testt.city nowait ON SELECTION BAR 2 OF shortcut wait window testt.state nowait Activate POPUP shortcut RELEASE POPUPS shortcut ENDPROC PROCEDURE cmdclose.Click thisform.release() ENDPROC ENDDEFINE