bb.donnay-software.com

Donnay Software Web Forums
It is currently Mon May 20, 2019 5:34 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat May 11, 2019 9:28 am 
Offline
User avatar

Joined: Tue Jul 28, 2015 5:15 am
Posts: 93
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:
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 ***


Top
 Profile  
 
PostPosted: Sat May 11, 2019 10:44 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 3902
Location: Boise, Idaho USA
DCREAD GUI SETFOCUS @oBrowse

OR

DCREAD GUI EVAL {||SetAppFocus(oBrowse)}

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Sat May 11, 2019 11:16 am 
Offline
User avatar

Joined: Tue Jul 28, 2015 5:15 am
Posts: 93
Works perfectly. Thank you!

Choo choo !!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group