how to start moving with arrows in a browser

If you are converting a text-based Clipper application, a FoxPro application or just writing an application from scratch, use this forum for your eXpress++ questions.
Post Reply
Message
Author
User avatar
alepap
Posts: 94
Joined: Tue Jul 28, 2015 5:15 am

how to start moving with arrows in a browser

#1 Post by alepap »

Hi

How to start moving with the arrows in a browser without having to click on a cell first?

Here is a sample. When the browser opens, I cant use the arrows. But if I click on a cell, than I can use the arrows to move around the bowser cells.


Code: Select all

FUNCTION XSample_46

/*
Cut and Paste

This sample demonstrates cutting a value from a row/column in
an array browse and pasting it to another row/column.  The value
in the cell that is cut is swapped with the value in the cell
pasted.  Use the right mouse button.
*/

LOCAL GetList := {}, oBrowse, aSchedule, i, j, oMenuBrow

aSchedule := Array(24)
FOR i := 1 TO 24
  aSchedule[i] := Array(8)
  aSchedule[i,1] := Str(i,2) + ':00'
  FOR j := 2 TO 8
     aSchedule[i,j] := Space(25)
  NEXT
NEXT

aSchedule[6,2] := Pad('John Smith',25)
aSchedule[8,3] := Pad('Laurie Jones',25)
aSchedule[9,4] := Pad('Tom Walker',25)
aSchedule[7,5] := Pad('Nancy Buffet',25)

@ 3,1 DCBROWSE oBrowse DATA aSchedule ;
      SIZE 80,14.5 FREEZELEFT {1} ;
      EDIT xbeBRW_ItemSelected MODE DCGUI_BROWSE_EDITDOWN ;
      DELETE xbeK_DEL ;
      INSERT xbeK_INS ;
      RBSELECT

DCBROWSECOL ELEMENT 1 WIDTH 4 HEADER "Time" PARENT oBrowse
DCBROWSECOL ELEMENT 2 WIDTH 9 HEADER "Sunday" PARENT oBrowse
DCBROWSECOL ELEMENT 3 WIDTH 9 HEADER "Monday" PARENT oBrowse
DCBROWSECOL ELEMENT 4 WIDTH 9 HEADER "Tuesday" PARENT oBrowse
DCBROWSECOL ELEMENT 5 WIDTH 9 HEADER "Wednesday" PARENT oBrowse
DCBROWSECOL ELEMENT 6 WIDTH 9 HEADER "Thursday" PARENT oBrowse
DCBROWSECOL ELEMENT 7 WIDTH 9 HEADER "Friday" PARENT oBrowse
DCBROWSECOL ELEMENT 8 WIDTH 9 HEADER "Saturday" PARENT oBrowse

DCSUBMENU oMenuBrow PROMPT "&Browse" PARENT oBrowse

DCMENUITEM "~Cut" PARENT oMenuBrow ACTION {||_XSample_46(oBrowse,2)}
DCMENUITEM "C~opy" PARENT oMenuBrow ACTION {||_XSample_46(oBrowse,3)}
DCMENUITEM "~Paste" PARENT oMenuBrow ACTION {||_XSample_46(oBrowse,4)}

DCREAD GUI ;
   FIT ;
   MODAL ;
   BUTTONS DCGUI_BUTTON_EXIT ;
   TITLE 'Double Click to EDIT, Right Click to Cut/Paste' ;
   EVAL {||_XSample_46(@oBrowse,1,@oMenuBrow,1)}

RETURN nil

/* -------------------------- */

STATIC FUNCTION _XSample_46 ( oBrowse, nMode, oMenuBrow )

STATIC cClipData

LOCAL i, aChildList, oXbp, nRow, nCol, oCellGroup

IF nMode = 1
   aChildList := oBrowse:ChildList()
   FOR i := 2 TO 8
      oXbp := oBrowse:getColumn(i)
      oCellGroup := oXbp:dataArea

      /* -- Attach menu to each cellgroup -- */
      oCellGroup:RbDown  := DC_MergeBlocks(oCellGroup:RbDown,;
              { |x,y,z| oMenuBrow:PopUp ( nil, x, 1 , ;
                XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN  ) })
   NEXT
ELSEIF nMode = 2  // Cut
  nRow := oBrowse:cargo[4]
  nCol := oBrowse:colPos
  cClipData := oBrowse:cargo[5,nRow,nCol]
  oBrowse:cargo[5,nRow,nCol] := Space(25)
  oBrowse:refreshCurrent()
ELSEIF nMode = 3  // Copy
  nRow := oBrowse:cargo[4]
  nCol := oBrowse:colPos
  cClipData := oBrowse:cargo[5,nRow,nCol]
ELSEIF nMode = 4  // Paste
  nRow := oBrowse:cargo[4]
  nCol := oBrowse:colPos
  oBrowse:cargo[5,nRow,nCol] := cClipData
  oBrowse:refreshCurrent()
ENDIF

RETURN nil
*** END OF EXAMPLE ***

User avatar
rdonnay
Site Admin
Posts: 4774
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: how to start moving with arrows in a browser

#2 Post by rdonnay »

DCREAD GUI SETFOCUS @oBrowse

OR

DCREAD GUI EVAL {||SetAppFocus(oBrowse)}
The eXpress train is coming - and it has more cars.

User avatar
alepap
Posts: 94
Joined: Tue Jul 28, 2015 5:15 am

Re: how to start moving with arrows in a browser

#3 Post by alepap »

Works perfectly. Thank you!

Choo choo !!!

Post Reply