Page 1 of 1

Problem with :moveColumn

Posted: Sun Oct 06, 2019 8:27 am
by danielF
Hi everyone...
I have a problem with moving column in a browse, I had working with 1.9 version without problem but when I build the project with 2.0 the colummns don't move the same way.
When I click right button in a column it shows a menu that permit to move this column to right or left, but if I click againg, the selected column is not the column I'm clicking...

I've tried the Express 2.0 sample and it works like mine, don't work popperly. Only work with the first time. I've tried to refreshing and forcestable but i doesn't woth either.

Any idea?

Thanks
Daniel


Function code in the EXP20 Sample:

STATIC FUNCTION BrowseMenu( oBrowse )

STATIC soMenu, soBrowse

LOCAL GetList[0], i

IF Valtype(soMenu) # 'O' .OR. soMenu:status()<=0 .OR. soBrowse # oBrowse

IF Valtype(soMenu) = 'O'
soMenu := nil
ENDIF

soBrowse := oBrowse

DCSUBMENU soMenu

DCMENUITEM 'Move Column &Left' PARENT soMenu ACTION {||soBrowse:moveColumn(-1)}
DCMENUITEM 'Move Column &Right' PARENT soMenu ACTION {||soBrowse:moveColumn(1)}
DCMENUITEM SEPARATOR PARENT soMenu
DCMENUITEM 'Restore Defaults' PARENT soMenu ACTION {||soBrowse:restoreDefaults()}

DCREAD GUI ;
PARENT oBrowse ;
EXIT

ENDIF

RETURN soMenu

* --------------

STATIC FUNCTION BrowseMenuBlock( oBrowse )

RETURN {|x,y,z,o|o := BrowseMenu( oBrowse ), ;
o:popup( nil, x, 1 , ;
XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN ) }


* -------------

PROC appsys ; RETURN

Re: Problem with :moveColumn

Posted: Sun Oct 06, 2019 6:30 pm
by rdonnay
It may be your version of eXpress++ that is the problem.

The following code works for me:

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL aDir, oBrowse, aHeadings, GetList[0], i, GetOptions

aDir := Directory()

aHeadings := { 'File;Name', ;
               'File;Size', ;
               'Date;Last;Write', ;
               'Time;Last;Write', ;
               'File;Attr', ;
               'Size;Extend;Attr', ;
               'Create;Date', ;
               'Create;Time', ;
               'Date;Last;Access', ;
               'Time;Last;Access' }

@ 0,0 DCSAY 'Click Right Button in a Column for menu' ;
      SAYSIZE 50 COLOR GRA_CLR_BLUE

@ 1,0 DCBROWSE oBrowse DATA aDir PRESENTATION DC_BrowPres() ;
      SIZE 40,20 FIT ;
      ID 'DIRECTORY_BROWSE' ;
      HEADLINES 3 ;
      RBSELECT ;
      RBDOWN BrowseMenuBlock(@oBrowse)

FOR i := 1 TO Len(aHeadings)
  DCBROWSECOL ELEMENT i HEADER aHeadings[i] ;
     WIDTH 6 PARENT oBrowse ;
     SORT _SortBlock(i,aDir)
NEXT

DCGETOPTIONS ;
   NOMINBUTTON ;
   NOMAXBUTTON ;
   AUTORESIZE ;
   BUTTONALIGN DCGUI_BUTTONALIGN_CENTER

DCREAD GUI ;
   FIT ;
   BUTTONS DCGUI_BUTTON_OK ;
   OPTIONS GetOptions ;
   TITLE 'Directory Browse' ;
   MODAL ;
   SETAPPWINDOW

RETURN nil

* -------------

STATIC FUNCTION _SortBlock( i, aDir )

RETURN {||ASort(aDir,,,{|a,b|a[1]<b[1]})}

* ----------------

STATIC FUNCTION BrowseMenu( oBrowse )

STATIC soMenu, soBrowse

LOCAL GetList[0], i

IF Valtype(soMenu) # 'O' .OR. soMenu:status()<=0 .OR. soBrowse # oBrowse

IF Valtype(soMenu) = 'O'
soMenu := nil
ENDIF

soBrowse := oBrowse

DCSUBMENU soMenu

DCMENUITEM 'Move Column &Left' PARENT soMenu ACTION {||soBrowse:moveColumn(-1)}
DCMENUITEM 'Move Column &Right' PARENT soMenu ACTION {||soBrowse:moveColumn(1)}
DCMENUITEM SEPARATOR PARENT soMenu
DCMENUITEM 'Restore Defaults' PARENT soMenu ACTION {||soBrowse:restoreDefaults()}

DCREAD GUI ;
PARENT oBrowse ;
EXIT

ENDIF

RETURN soMenu

* --------------

STATIC FUNCTION BrowseMenuBlock( oBrowse )

RETURN {|x,y,z,o|o := BrowseMenu( oBrowse ), ;
o:popup( nil, x, 1 , ;
XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN ) }


* -------------

PROC appsys ; RETURN