User Tools

Site Tools


prop_selstart.htm
Navigation:  Language Reference > App C - PROP: Runtime Properties > Complete Property List >====== PROP:SelStart (or PROP:Selected) and PROP:SelEnd ====== Previous pageReturn to chapter overviewNext page

PROP:SelStart (also named PROP:Selected) sets or retrieves the beginning (inclusive) character to mark as a block in an ENTRY or TEXT control. It positions the data entry cursor left of the character, and sets PROP:SelEnd to zero (0) to indicate no block is marked. It also identifies the currently highlighted entry in a LIST or COMBO control (usually coded as PROP:Selected for this purpose). For COMBO controls, PROP:Selected should be applied to the PROP:ListFeq of the COMBO, and not to the combo FEQ directly.

PROP:SelEnd sets or retrieves the ending (inclusive) character to mark as a block in an ENTRY or TEXT control. A value of -1 is a special value that indicates that the selection goes to the end of the target control's text.

Example:

WinView  WINDOW('View'),AT(0,0,320,200),MDI,MAX,HVSCROLL

         ENTRY(@S30),AT(0,0,320,180),USE(Fil:Field),ALRT(F10Key)

         LIST,AT(6,6,120,90),USE(?List),FORMAT('120L'),FROM(Q),IMM

        END

CODE

OPEN(WinView)

ACCEPT

 CASE ACCEPTED()

 OF ?List

  GET(Q,?List{PROP:Selected})     !Get highlighted entry from queue

 OF ?Fil:Field

  SETCLIPBOARD(Fil:Field[?Fil:Field{PROP:SelStart} : ?Fil:Field{PROP:SelEnd}])

                !Place highlighted string slice in Windows' clipboard

 END

END

Example: using a COMBO control in an EIP configuration

CASE EVENT()                       ! Trap the event

 OF EVENT:NewSelection            ! If the event is a new selection

                                  ! And it's a key we want…

 IF KEYCODE() <;> UpKey AND KEYCODE() <;> DownKey AND |    

    KEYCODE() <;> PgDnKey AND KEYCODE() <;> PgUpKey

  UPDATE(SELF.FEQ)

  Loc:Offset = SELF.FEQ{PROP:SelStart} - 1    ! Figure out where the cursor is

                                              !in the item field

  ! Put the entered code into a local variable:

  Loc:ItemCode = SUB(ItemList.Q.SON:ItemCode,1,Loc:Offset)

  ! Loop through the local item queue:

  LOOP Loc:LqRecordCount = 1 to RECORDS(LQ:Queue)

   GET(LQ:Queue, Loc:LqRecordCount)

   IF LEFT(LQ:ItemCode,LEN(CLIP(Loc:ItemCode))) = CLIP(Loc:ItemCode)

    IF Loc:LqRecordCount > 1

     Loc:LQ:Position = Loc:LqRecordCount - 1   ! The record we want is the one

                                               ! before the one we're on.

    ELSE

     Loc:LQ:Position = 1                       ! Otherwise it's the first..

    END

   END

   ! Position to the LIST COMBO control:

   (SELF:FEQ{PROP:ListFeq}){PROP:Selected}=Loc:LQ:Position

   CHANGE(SELF.FEQ, LQ:ItemCode)          ! Change the queue to reflect it

   BREAK

  END

 END

END

Example: highlight a specific row in a List control without changing focus

?List1{PROP:Selected} = 6        !put the highlight bar on the sixth row

See Also: PROP:ListFEQ

prop_selstart.htm.txt · Last modified: 2021/04/15 15:57 (external edit)