How I add a Button in DCBROWSECOL inside the HEADER

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

How I add a Button in DCBROWSECOL inside the HEADER

#1 Post by digitsoft »

hello Roger
How I add a Button in DCBROWSECOL inside the HEADER
Nolberto Paulino
Regards

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

Re: How I add a Button in DCBROWSECOL inside the HEADER

#2 Post by rdonnay »

Here is a test program:

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], oButton, aDir, oBrowse, i, cCaption, GetOptions

aDir := Directory()

@ 0,0 DCBROWSE oBrowse DATA aDir SIZE 50,10 FIT

FOR i := 1 TO 4
  DCBROWSECOL ELEMENT i HEADER Chr(255) WIDTH 10 PARENT oBrowse
NEXT

DCGETOPTIONS RESIZE

DCREAD GUI FIT TITLE 'Button in Header of Browse' ;
   OPTIONS GetOptions ;
   EVAL {||AddHeaderButton(GetList,oBrowse,1,'File Name'), ;
           AddHeaderButton(GetList,oBrowse,2,'File Size'), ;
           AddHeaderButton(GetList,oBrowse,3,'File Date'), ;
           AddHeaderButton(GetList,oBrowse,4,'File Time'), ;
           nil}

RETURN nil

* ---------

PROC appsys ; RETURN

* ----------

STATIC FUNCTION AddHeaderButton(aGetList,oBrowse,nCol,cCaption,bAction)

LOCAL GetList[0], ;
      oButton, ;
      oHeading := oBrowse:getColumn(nCol):heading, ;
      aSize := oHeading:currentSize()

@ 2,2 DCPUSHBUTTONXP SIZE aSize[1]-4, aSize[2]-4 PIXEL ;
      CAPTION cCaption ;
      ACTION bAction ;
      OBJECT oButton ;
      EVAL {|o|oHeading:resize := {||oButton:setSize({oHeading:currentSize()[1]-4,oButton:currentSize()[2]})}} ;
      PARENT oHeading

DCREAD GUI EXIT PARENT oBrowse

DC_MergeGetLists(aGetList,GetList)

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

User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: How I add a Button in DCBROWSECOL inside the HEADER

#3 Post by digitsoft »

Thanks Roger
rdonnay wrote:Here is a test program:

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], oButton, aDir, oBrowse, i, cCaption, GetOptions

aDir := Directory()

@ 0,0 DCBROWSE oBrowse DATA aDir SIZE 50,10 FIT

FOR i := 1 TO 4
  DCBROWSECOL ELEMENT i HEADER Chr(255) WIDTH 10 PARENT oBrowse
NEXT

DCGETOPTIONS RESIZE

DCREAD GUI FIT TITLE 'Button in Header of Browse' ;
   OPTIONS GetOptions ;
   EVAL {||AddHeaderButton(GetList,oBrowse,1,'File Name'), ;
           AddHeaderButton(GetList,oBrowse,2,'File Size'), ;
           AddHeaderButton(GetList,oBrowse,3,'File Date'), ;
           AddHeaderButton(GetList,oBrowse,4,'File Time'), ;
           nil}

RETURN nil

* ---------

PROC appsys ; RETURN

* ----------

STATIC FUNCTION AddHeaderButton(aGetList,oBrowse,nCol,cCaption,bAction)

LOCAL GetList[0], ;
      oButton, ;
      oHeading := oBrowse:getColumn(nCol):heading, ;
      aSize := oHeading:currentSize()

@ 2,2 DCPUSHBUTTONXP SIZE aSize[1]-4, aSize[2]-4 PIXEL ;
      CAPTION cCaption ;
      ACTION bAction ;
      OBJECT oButton ;
      EVAL {|o|oHeading:resize := {||oButton:setSize({oHeading:currentSize()[1]-4,oButton:currentSize()[2]})}} ;
      PARENT oHeading

DCREAD GUI EXIT PARENT oBrowse

DC_MergeGetLists(aGetList,GetList)

RETURN nil
Nolberto Paulino
Regards

Post Reply