| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| danm Intermediate
 
 
 Joined: 29 Jun 2004
 Posts: 170
 Topics: 73
 
 
 | 
			
				|  Posted: Thu May 12, 2005 2:50 pm    Post subject: TBDISPL |   |  
				| 
 |  
				| I display a table on a panel: 
 
  	  | Code: |  	  | COMMAND ==>
 
 Person
 ----------
 1    Tom
 2    John
 3    Jane
 4    Amy
 5    Carl
 
 | 
 To select a row, user can either type in the number 1 to 5 in the COMMAND field or move the cursor to the row and press ENTER.  I can get the selected row if I move the cursor to the row, alter the row number and press ENTER.  For example, move cursor to line 2, change 2 to 'X', then press ENTER (Currow is set to 2 in the REXX program).  If I move the cursor to row 2 and press ENTER (Currrow is set to 0).   How can I get the selected row number without overtyping the row number?
 
 
 [/code] 	  | Code: |  	  | 
 )PANEL
 )ATTR DEFAULT(%+_)
 ! TYPE(OUTPUT) INTENS(HIGH) PAD(' ') JUST(ASIS) COLOR(TURQ)
 )BODY
 %COMMAND ==>_ZCMD
 #
 +     Person
 +     ----------
 )MODEL
 _Row !Fname
 )INIT
 &ZCMD = ''
 &ZTDMARK=' '
 )REINIT
 &ZTDMARK=' '
 )PROC
 &COMMAND = ' '
 )END
 
 
 /* REXX */
 address ISPEXEC
 Names = 'Tom John Jane Amy Carl'
 "TBCREATE MYLIST KEYS(ROW) NAMES(FNAME) NOWRITE REPLACE"
 Rows = words(Names)
 Do Row = 1 to Rows
 FName = word(Names,Row)
 "TBADD MYLIST MULT(5)"
 End  /* Do Row =  1 to 5 */
 
 Cancel = 0
 "TBTOP MYLIST"
 Do until Cancel
 "TBDISPL MYLIST PANEL(LIST) POSITION(CURROW)"
 If rc = 8 then Cancel = 1
 Else do
 say 'ZCmd =' ZCmd
 say 'Currow =' Currow
 End   /* Else do */
 End   /* Do until Cancel */
 Exit
 
 | 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| superk Advanced
 
  
 Joined: 19 Dec 2002
 Posts: 684
 Topics: 5
 
 
 | 
			
				|  Posted: Thu May 12, 2005 3:13 pm    Post subject: Re: TBDISPL |   |  
				| 
 |  
				| How about adding this line: 
  	  | Code: |  	  | /* REXX */
 ...
 "TBTOP MYLIST"
 Do until Cancel
 "TBDISPL MYLIST PANEL(LIST) POSITION(CURROW)"
 If rc = 8 then Cancel = 1
 Else do
 
 ==> If ZCmd <> '' Then "TBSKIP MYLIST ROW("ZCMD") POSITION CURROW)"
 
 say 'ZCmd =' ZCmd
 say 'Currow =' Currow
 End   /* Else do */
 End   /* Do until Cancel */
 Exit
 
 | 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| danm Intermediate
 
 
 Joined: 29 Jun 2004
 Posts: 170
 Topics: 73
 
 
 | 
			
				|  Posted: Fri May 13, 2005 7:59 am    Post subject: |   |  
				| 
 |  
				| Superk, 
 Your suggestion will not work the way I want.  The selected row is determinated in this order:
 
 1. Row number entered in the Command field
 2. If Command field is blank, pick the row where is cursor is positioned.
 
 Your statement
 If ZCmd <> '' Then "TBSKIP MYLIST ROW("ZCMD") POSITION(CUROW)"
 will never be executed since the Command field is blank (see 2 above).
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| arnold57 Beginner
 
 
 Joined: 01 Oct 2004
 Posts: 30
 Topics: 0
 
 
 | 
			
				|  Posted: Wed Jun 01, 2005 4:56 pm    Post subject: |   |  
				| 
 |  
				| In the )PROC section add: 
 IF (&ZCMD = &Z) &ZCMD = .CSRROW
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |