Grids and Comboboxes

More advanced topics discussed.

Moderators: Susan Smith, admin, Gabriel

Post Reply
ranjsuri
Posts: 10
Joined: Wed Aug 17, 2011 11:00 am

Grids and Comboboxes

Post by ranjsuri »

I have a screen with a combobox and a grid. It seems like the screen always lands focus on the combobox irrespective of the order in the INPUT statement. I however, need it to default to the grid. Can someone look at the code and make suggestions on what I could try?

Code: Select all

00020   DIM ComboValues$(3)*10
00040   DATA "Value 1","Value 2","Value 3"
00060   READ Mat ComboValues$
00080   DIM Headings$(5), Widths(5), Forms$(5)*25
00100   LET Headings$(1)="Col 1": LET Headings$(2)="Col 2": LET Headings$(3)="Col 3": LET Headings$(4)="Col 4": LET Headings$(5)="Col 5"
00120   MAT Widths=(4)
00140   MAT Forms$=("CC 2,^nosortPLAEX")
00160   DATA "1","2","3","4","5","6","7","8","9","10"
00180   READ Mat GridValues$
00200   execute "con gui on"
00220   OPEN #(Cal:=2): "Srow=5,Scol=5,Rows=13,Cols=30,Caption=GRID COMBO,Parent=none,font=calibri:light:small", DISPLAY, OUTIN  !
00240   PRINT #Cal: Newpage
00260   PRINT #Cal, FIELDS "2,13,9/combo 9,=,SELECT ": Mat ComboValues$
00280   PRINT #Cal, FIELDS "4,2,grid 7/28,headers": (Mat Headings$,Mat Widths,Mat Forms$)
00300   PRINT #Cal, FIELDS "4,2,grid 7/28,=S,500": (Mat GridValues$)
00320   INP: INPUT #Cal, FIELDS "4,2,grid 7/28,CNT,SELONE,1001;2,13,9/combo 9,C 9": Cntrow,SelectedComboValue$
00340   if fkey<>93 then
00360   PRINT #Cal, FIELDS "12,16,CL 14": Str$(Curfld) & " " & Str$(CurCol) & " " & Str$(CurRow)
00380   GOTO INP
00400   end if
00420   end
Thanks
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

Your leading parameters for the GRID make it all protectd so keystrokes are limited and don't interact with the GRID.

If you place a CURFLD(1) at the beginning of the INP line it will force focus to the GRID.

Not sure what you are trying to accomplish.

FNGeorge
ranjsuri
Posts: 10
Joined: Wed Aug 17, 2011 11:00 am

Post by ranjsuri »

I had tried that and that did not help either. Code is below

Code: Select all

00020   DIM ComboValues$(3)*10
00040   DATA "Value 1","Value 2","Value 3"
00060   READ Mat ComboValues$
00080   DIM Headings$(5), Widths(5), Forms$(5)*25
00100   LET Headings$(1)="Col 1": LET Headings$(2)="Col 2": LET Headings$(3)="Col 3": LET Headings$(4)="Col 4": LET Headings$(5)="Col 5"
00120   MAT Widths=(4)
00140   MAT Forms$=("CC 2,^nosortLAEX")
00160   DATA "1","2","3","4","5","6","7","8","9","10"
00180   READ Mat GridValues$
00200   execute "con gui on"
00220   OPEN #(Cal:=2): "Srow=5,Scol=5,Rows=13,Cols=30,Caption=GRID COMBO,Parent=none,font=calibri:light:small", DISPLAY, OUTIN  !
00240   PRINT #Cal: Newpage
00260   PRINT #Cal, FIELDS "2,13,9/combo 9,=,SELECT ": Mat ComboValues$
00280   PRINT #Cal, FIELDS "4,2,grid 7/28,headers": (Mat Headings$,Mat Widths,Mat Forms$)
00300   PRINT #Cal, FIELDS "4,2,grid 7/28,=S,500": (Mat GridValues$)
00320   INP:       !
00330 LET CURFLD(1) !:
      INPUT #Cal, FIELDS "4,2,grid 7/28,CNT,SELONE,1001;2,13,9/combo 9,C 9": Cntrow,SelectedComboValue$
00340   if fkey<>93 then
00360   PRINT #Cal, FIELDS "12,16,CL 14": Str$(Curfld) & " " & Str$(CurCol) & " " & Str$(CurRow)
00380   GOTO INP
00400   end if
00420   end
What I am trying to accomplish is a screen where the primary focus is always on the grid unless the user chooses to intentionally pick the combobox. The arrow keys for instance, should remain active and on the grid, so the user can navigate between cells using them, without having to tab back from the combobox into the grid.

Appreciate the help!
Ranjini
gordon
Posts: 358
Joined: Fri Apr 24, 2009 6:02 pm

Post by gordon »

Statement 330 says
2,13,9/combo 9,C 9"
Chnage it to say
2,13,9/combo 9"
Not sure what you intended by the C 9, or where you obtained the syntax for the conbo control.
ranjsuri
Posts: 10
Joined: Wed Aug 17, 2011 11:00 am

Post by ranjsuri »

The issue has been resolved. The "C 9" in the input statement for the combobox seemed to be the issue. I had used the wiki sample on combobox as my template and that had a typo (Luis has since fixed it).

Code: Select all

00020   DIM Combovalues$(3)*10
00040   DATA "Value 1","Value 2","Value 3"
00060   READ Mat Combovalues$
00080   DIM Headings$(5), Widths(5), Forms$(5)*25
00100   LET Headings$(1)="Col 1": LET Headings$(2)="Col 2": LET Headings$(3)="Col 3": LET Headings$(4)="Col 4": LET Headings$(5)="Col 5"
00120   MAT Widths=(4)
00140   MAT Forms$=("CC 2,^nosortLAEX")
00160   DATA "1","2","3","4","5","6","7","8","9","10"
00180   READ Mat Gridvalues$
00200   EXECUTE "con gui on"
00220   OPEN #(Cal:=2): "Srow=5,Scol=5,Rows=13,Cols=30,Caption=GRID COMBO,Parent=none,font=calibri:light:small", DISPLAY, OUTIN  ! 
00240   PRINT #Cal: Newpage
00260   PRINT #Cal, FIELDS "2,13,9/combo 9,=,SELECT ": Mat Combovalues$
00280   PRINT #Cal, FIELDS "4,2,grid 7/28,headers": (Mat Headings$,Mat Widths,Mat Forms$)
00300   PRINT #Cal, FIELDS "4,2,grid 7/28,=S,500": (Mat Gridvalues$)
00320 INP: INPUT #Cal, FIELDS "4,2,grid 7/28,CNT,SELONE,1001;2,13,9/combo 9": Cntrow,Selectedcombovalue$
00340   IF Fkey<>93 THEN 
00360     PRINT #Cal, FIELDS "12,16,CL 14": Str$(Curfld) & " " & Str$(Curcol) & " " & Str$(Currow)
00380     GOTO INP
00400   END IF 
00420   END 
Post Reply