bb.donnay-software.com

Donnay Software Web Forums
It is currently Sun Sep 15, 2019 3:15 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: DCGETBROWSE
PostPosted: Wed Sep 04, 2019 7:03 am 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:39 pm
Posts: 465
Hi Roger/All

How can I make the command below to have other parameter like:

#command DCGETBROWSE [DATA <d>] [GET <g>] => GetBrowse( <d>, @<g>, GetList )

Example:
Code:
#command DCGETBROWSE [DATA <d>] [GET <g>] => GetBrowse( <d>, @<g>, GetList, aColSize, aColHead, aColWidth)

FUNCTION GetBrowse( aData, oGet, GetList, aColSize, aColHead, aColWidth )

LOCAL nPointer, oBrowse, oStatic

@ DCGUI_ROW, DCGUI_COL DCPUSHBUTTON SIZE 20,20 PIXEL ;
      CAPTION 'u' FONT '12.Marlett' ;
      ACTION {||PostAppEvent(xbeP_Keyboard,xbeK_SH_DOWN,,oGet)} ;
      NOTABSTOP

@ 0,0 DCSTATIC OBJECT oStatic TYPE XBPSTATIC_TYPE_TEXT SIZE 10,10 ;
      INVISIBLE

@ 0,0 DCBROWSE oBrowse DATA aData ;
       PARENT oStatic ;
       NOTABSTOP ;
       SIZE 10,10 ;
       NOHSCROLL ;
       POINTER nPointer ;
       ITEMSELECTED {||oGet:setData(Pad(aData[nPointer,1],20)), ;
                     DC_GetRefresh(oGet), ;
                     oStatic:hide(), ;
                     SetAppFocus(oGet)} ;
       LOSTFOCUS {|a,b,o|o:hide()}

DCBROWSECOL ELEMENT 1 WIDTH 16 PARENT oBrowse

DCEVAL {||oStatic:setPos({oGet:currentPos()[1], ;
                          oGet:currentPos()[2]-oStatic:currentSize()[2]}), ;
          oStatic:setSize({oGet:currentSize()[1]+15,oStatic:currentSize()[2]}), ;
          oBrowse:setSize(oStatic:currentSize()), ;
          oGet:setInputFocus := {||oStatic:hide()}, ;
          oGet:keyboard := {|nKey,b,oGet|SeekFile(aData,nKey,oGet,oBrowse,oStatic)} }

RETURN nil

STATIC FUNCTION SeekFile( aDir, nKey, oGet, oBrowse, oStatic )

LOCAL nFound, cBuffer := Trim(oGet:get:buffer)

IF nKey == xbeK_BS .OR. nKey == xbeK_DEL .OR. nKey == xbeK_TAB
  RETURN nil
ELSEIF nKey == xbeK_SH_DOWN
  oStatic:show()
  oStatic:toFront()
  oBrowse:show()
  oBrowse:forceStable()
  oBrowse:refreshAll()
  SetAppFocus(oBrowse)
  RETURN nil
ELSEIF nKey == xbeK_DOWN .AND. oStatic:isVisible()
  SetAppFocus(oBrowse)
  RETURN nil
ENDIF

IF nKey == xbeK_ENTER
  IF oStatic:isVisible()
    PostAppEvent(xbeBRW_ItemSelected,,,oBrowse)
  ENDIF
  RETURN nil
ENDIF

IF !Empty(cBuffer)
  nFound := AScan(aDir,{|a|a[1]=cBuffer})
  IF nFound > 0
    oBrowse:arrayElement := nFound
    oBrowse:refreshAll()
    oStatic:show()
    oStatic:toFront()
    oBrowse:show()
  ENDIF
ELSE
  oStatic:hide()
ENDIF

RETURN nil

)


Top
 Profile  
 
 Post subject: Re: DCGETBROWSE
PostPosted: Wed Sep 04, 2019 8:01 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 3975
Location: Boise, Idaho USA
I don't understand your question.

Are you saying that you want to add 3 more parameters? aColSize, aColHead, aColWidth

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


Top
 Profile  
 
 Post subject: Re: DCGETBROWSE
PostPosted: Wed Sep 04, 2019 8:34 am 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:39 pm
Posts: 465
Yes, exactly so that we can have a multi-column browse with possibility of browse header and corresponding column width.

It will be good to be able to specify the column position that will be returned to the GET.

Thanks

Joe


Top
 Profile  
 
 Post subject: Re: DCGETBROWSE
PostPosted: Mon Sep 09, 2019 3:38 am 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:39 pm
Posts: 465
Hi Roger/All

DCGETBROWSE DATA aItemDesc GET oItem

Requires DCGETOPTIONS NOEDITNAVKEYS {||.f.} to work correctly but my clients are used to using ENTER key to move from a GET field to another and will not like to change it. Any workaround ?

Thanks

Joe


Top
 Profile  
 
 Post subject: Re: DCGETBROWSE
PostPosted: Mon Sep 09, 2019 6:47 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 3975
Location: Boise, Idaho USA
Quote:
How can I make the command below to have other parameter like:


I still don't understand what you are asking.

You showed that you know how to make a command with 3 parameters.

How are 6 parameters any different?

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


Top
 Profile  
 
 Post subject: Re: DCGETBROWSE
PostPosted: Mon Sep 09, 2019 6:49 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 3975
Location: Boise, Idaho USA
Quote:
Requires DCGETOPTIONS NOEDITNAVKEYS {||.f.} to work correctly


WHAT requires this to work correctly?

I don't understand what you are asking.

Start from the beginning and tell me what it is that you are trying to do?

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


Top
 Profile  
 
 Post subject: Re: DCGETBROWSE
PostPosted: Mon Sep 09, 2019 1:54 pm 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:39 pm
Posts: 465
OK.

The following code is sample from \EXP19\SAMPLE\GETBROWSE

1. Replace the DCGETOPTIONS of the Main() in this sample with DCGETOPTIONS TABSTOP NOSUPERVISE // NOEDITNAVKEYS {||.f.}
Note that I comment out // NOEDITNAVKEYS {||.f.}

2. Recompile and the run the sample.

3. In the first get enter A or B or any Letter. Then press 'DOWN arrow' continuously and notice the behavior of the browse.

4. If you un-comment the NOEDITNAVKEYS {||.f.} by adding it back to the DCGETOPTIONS the program works correctly BUT will not
allow you to use the ENTER key to move from GET cFileName1 to GET cFileName2




Code:
 

/*
This example show how to connect a browse to a Get as a dropdown.



*/

#command DCGETBROWSE [DATA <d>] [GET <g>] => ;
  GetBrowse( <d>, @<g>, GetList )

#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], GetOptions, oGet1, oGet2, oGet3, aDir1, aDir2, aDir3, ;
      i, cFileName1, cFileName2, cFileName3

aDir1 := Directory('..\..\data\*.*')

FOR i := 1 TO Len(aDir1)
  aDir1[i,1] := Upper(aDir1[i,1])
NEXT

aDir2 := AClone(aDir1)
aDir3 := AClone(aDir2)

cFileName1 := Space(20)
cFileName2 := Space(20)
cFileName3 := Space(20)

@ 0,0 DCSAY 'Enter File Name 1' GET cFileName1 ;
      PICTURE '@!' ;
      SAYSIZE 0 ;
      GETOBJECT oGet1 ;

DCGETBROWSE DATA aDir1 GET oGet1

@ 2,0 DCSAY 'Enter File Name 2' GET cFileName2 ;
      PICTURE '@!' ;
      SAYSIZE 0 ;
      GETOBJECT oGet2 ;

DCGETBROWSE DATA aDir2 GET oGet2

@ 4,0 DCSAY 'Enter File Name 3' GET cFileName3 ;
      PICTURE '@!' ;
      SAYSIZE 0 ;
      GETOBJECT oGet3 ;

DCGETBROWSE DATA aDir3 GET oGet3

DCGETOPTIONS  TABSTOP NOSUPERVISE  // NOEDITNAVKEYS {||.f.}

DCREAD GUI FIT TITLE 'Get with a Browse DropDown' ;
       OPTIONS GetOptions

RETURN nil

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

FUNCTION GetBrowse( aData, oGet, GetList )

LOCAL nPointer, oBrowse, oStatic

@ DCGUI_ROW, DCGUI_COL DCPUSHBUTTON SIZE 20,20 PIXEL ;
      CAPTION 'u' FONT '12.Marlett' ;
      ACTION {||PostAppEvent(xbeP_Keyboard,xbeK_SH_DOWN,,oGet)} ;
      NOTABSTOP

@ 0,0 DCSTATIC OBJECT oStatic TYPE XBPSTATIC_TYPE_TEXT SIZE 10,10 ;
      INVISIBLE

@ 0,0 DCBROWSE oBrowse DATA aData ;
       PARENT oStatic ;
       NOTABSTOP ;
       SIZE 10,10 ;
       NOHSCROLL ;
       POINTER nPointer ;
       ITEMSELECTED {||oGet:setData(Pad(aData[nPointer,1],20)), ;
                     DC_GetRefresh(oGet), ;
                     oStatic:hide(), ;
                     SetAppFocus(oGet)} ;
       LOSTFOCUS {|a,b,o|o:hide()}

DCBROWSECOL ELEMENT 1 WIDTH 16 PARENT oBrowse

DCEVAL {||oStatic:setPos({oGet:currentPos()[1], ;
                          oGet:currentPos()[2]-oStatic:currentSize()[2]}), ;
          oStatic:setSize({oGet:currentSize()[1]+15,oStatic:currentSize()[2]}), ;
          oBrowse:setSize(oStatic:currentSize()), ;
          oGet:setInputFocus := {||oStatic:hide()}, ;
          oGet:keyboard := {|nKey,b,oGet|SeekFile(aData,nKey,oGet,oBrowse,oStatic)} }

RETURN nil

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

PROC appsys ; return

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

STATIC FUNCTION SeekFile( aDir, nKey, oGet, oBrowse, oStatic )

LOCAL nFound, cBuffer := Trim(oGet:get:buffer)

IF nKey == xbeK_BS .OR. nKey == xbeK_DEL .OR. nKey == xbeK_TAB
  RETURN nil
ELSEIF nKey == xbeK_SH_DOWN
  oStatic:show()
  oStatic:toFront()
  oBrowse:show()
  oBrowse:forceStable()
  oBrowse:refreshAll()
  SetAppFocus(oBrowse)
  RETURN nil
ELSEIF nKey == xbeK_DOWN .AND. oStatic:isVisible()
  SetAppFocus(oBrowse)
  RETURN nil
ENDIF

IF nKey == xbeK_ENTER
  IF oStatic:isVisible()
    PostAppEvent(xbeBRW_ItemSelected,,,oBrowse)
  ENDIF
  RETURN nil
ENDIF

IF !Empty(cBuffer)
  nFound := AScan(aDir,{|a|a[1]=cBuffer})
  IF nFound > 0
    oBrowse:arrayElement := nFound
    oBrowse:refreshAll()
    oStatic:show()
    oStatic:toFront()
    oBrowse:show()
  ENDIF
ELSE
  oStatic:hide()
ENDIF

RETURN nil





Top
 Profile  
 
 Post subject: Re: DCGETBROWSE
PostPosted: Mon Sep 09, 2019 4:00 pm 
Offline
User avatar

Joined: Wed Feb 24, 2010 3:44 pm
Posts: 1139
hi

as i understand you want a different Way to navigate when your Customer press ENTER.

you have something like this
Code:
   oGet:keyboard := {|nKey,b,oGet|SeekFile(aData,nKey,oGet,oBrowse,oStatic)} }

STATIC FUNCTION SeekFile( aDir, nKey, oGet, oBrowse, oStatic )
...
IF nKey == xbeK_BS .OR. nKey == xbeK_DEL .OR. nKey == xbeK_TAB
...
ELSEIF nKey == xbeK_SH_DOWN
...
ELSEIF nKey == xbeK_DOWN .AND. oStatic:isVisible()
...
ENDIF
// put this as first !
IF nKey == xbeK_ENTER

while you want to change ENTER put these line first

Code:
IF nKey == xbeK_ENTER
   IF iEdit = .T.  // allow Edit
      PostAppEvent(xbeBRW_ItemSelected,,,oBrowse)
   ELSE
      PostAppEvent(xbeK_DOWN,,,oBrowse)
   ENDIF
ENDIF

DO CASE
   CASE nKey == xbeK_BS .OR. nKey == xbeK_DEL .OR. nKey == xbeK_TAB
...
when lEdit = .F. and press ENTER than Cursor move DOWN in Browse.
is this what you want :?:

_________________
greetings by OHR
Jimmy


Top
 Profile  
 
 Post subject: Re: DCGETBROWSE
PostPosted: Tue Sep 10, 2019 4:26 am 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:39 pm
Posts: 465
Hi Jimmy

I dont understand your solution.

Pls insert the codes required in the seekfile function for me to run directly.

Thanks.

Joe


Top
 Profile  
 
 Post subject: Re: DCGETBROWSE
PostPosted: Tue Sep 10, 2019 3:23 pm 
Offline
User avatar

Joined: Wed Feb 24, 2010 3:44 pm
Posts: 1139
hi,

you want to change behavior of ENTER and you have a o:Keyboard Slot.
so make Change in o:Keyboard and not in Express++ CLASS.

_________________
greetings by OHR
Jimmy


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 16 guests


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