DCBROWSE Vertical Bar using PGDBE error

This forum is for eXpress++ general support.
Post Reply
Message
Author
Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

DCBROWSE Vertical Bar using PGDBE error

#1 Post by Andy Edward »

Hi Roger,

Trying out PGDBE with DCBROWSE, but got an error when dragging down the vertical bar
Untitled-2.gif
Untitled-2.gif (82.14 KiB) Viewed 8060 times

Code: Select all

#include "dctree.ch"
#INCLUDE "dccursor.CH"
#include "dcdialog.ch"
#include "dcbitmap.ch"
#include "dcicon.ch"
#include "appevent.ch"
#include "xbp.ch"
#include "inkey.ch"
#include "dcmsg.ch"
#include "DCGRAPH.CH"
#INCLUDE "GRA.CH"
#include "Dmlb.ch"     && 20090827
#include "DbfDbe.ch"   && 20090827

#include "pgdbe.ch"

PROCEDURE Main

LOCAL oSession
LOCAL cConnStr
LOCAL GetList := {}, aPres, oBrowse, oToolBar, aColors, bColor, GetOptions

DbeLoad("pgdbe")
DbeSetDefault("pgdbe")

cConnStr := "DBE=pgdbe;server=localhost;"
cConnStr += "db=testpgdbe;uid=postgres;pwd=postgres"

oSession := DacSession():New(cConnStr)
IF(!oSession:IsConnected())
  MsgBox("Connection failed ("+Var2Char(oSession:GetLastMessage())+")")
  QUIT
ENDIF

//MsgBox("Connected to PostgreSQL server")
IF(!TABLE("ytdtrnp"))
   MsgBox("No ytdtrnp table")
ENDIF

USE YTDTRNP INDEX YTDTRNP5 ALIAS COLLECT NEW

aColors := { {GRA_CLR_WHITE,GRA_CLR_DARKRED}, ;
             {GRA_CLR_WHITE,GRA_CLR_DARKBLUE}, ;
             {GRA_CLR_BLACK,GRA_CLR_DARKGREEN} }

bColor := {|x|x:=COLLECT->for_sale, ;
              x := Min(x,2), ;
              x := Max(x,0), ;
              aColors[x+1]}

aPres := ;
  { { XBP_PP_COL_HA_FGCLR, GRA_CLR_WHITE },    /*  Header FG Color  */     ;
    { XBP_PP_COL_HA_BGCLR, GRA_CLR_DARKGRAY }, /*  Header BG Color  */     ;
    { XBP_PP_COL_FA_FGCLR, GRA_CLR_YELLOW },   /*  Footer FG Color  */     ;
    { XBP_PP_COL_FA_BGCLR, GRA_CLR_DARKGRAY }, /*  Footer BG Color  */     ;
    { XBP_PP_COL_DA_ROWSEPARATOR, XBPCOL_SEP_DOTTED },  /* Row Sep  */     ;
    { XBP_PP_COL_DA_COLSEPARATOR, XBPCOL_SEP_DOTTED },  /* Col Sep  */     ;
    { XBP_PP_COL_DA_ROWHEIGHT, 20 },                  /* Row Height */     ;
    { XBP_PP_COL_DA_CELLHEIGHT, 20 }  }              /* Cell Height */

/* ----- Create ToolBar ----- */

@ 1,1 DCTOOLBAR oToolBar                               ;
   SIZE 77, 1.5

DCADDBUTTON CAPTION 'Top'                              ;
   SIZE 9                                              ;
   ACTION {||dbGoTop(), DC_GetRefresh(GetList)}        ;
   WHEN {||!DC_TestBof()}                              ;
   PARENT oToolBar                                     ;
   TOOLTIP 'Go to top of file'

DCADDBUTTON CAPTION 'Previous'                         ;
   SIZE 9                                              ;
   ACTION {||dbSkip(-1), DC_GetRefresh(GetList)}       ;
   WHEN {||!DC_TestBof()}                              ;
   PARENT oToolBar                                     ;
   TOOLTIP 'Skip to previous record in file'

DCADDBUTTON CAPTION 'Next'                             ;
   SIZE 9                                              ;
   ACTION {||dbSkip(1), DC_GetRefresh(GetList)}        ;
   WHEN {||!DC_TestEof()}                              ;
   PARENT oToolBar                                     ;
   TOOLTIP 'Skip to next record in file'

DCADDBUTTON CAPTION 'Bottom'                           ;
   SIZE 9                                              ;
   ACTION {||dbGoBottom(), DC_GetRefresh(GetList)}     ;
   WHEN {||!DC_TestEof()}                              ;
   PARENT oToolBar                                     ;
   TOOLTIP 'Go to Bottom of file'

DCADDBUTTON CAPTION 'APPEND'                           ;
   SIZE 9                                              ;
   ACTION {||APPENDHERE(), DC_GetRefresh(GetList)}     ;
   PARENT oToolBar                                     ;
   TOOLTIP 'APPENDING'

DCADDBUTTON CAPTION 'DELETING'                           ;
   SIZE 9                                              ;
   ACTION {||IIF(RLOCK(),DBDELETE(),), DC_GetRefresh(GetList)}     ;
   PARENT oToolBar                                     ;
   TOOLTIP 'DELETING'

DCADDBUTTON CAPTION 'SEEK'                           ;
   SIZE 9                                              ;
   ACTION {||SEEKHERE(), DC_GetRefresh(GetList)}     ;
   PARENT oToolBar                                     ;
   TOOLTIP 'SEEK'


/* ----- Create browse ----- */

@ 3,1 DCBROWSE oBrowse ALIAS 'COLLECT'                 ;
   SIZE 77,11.8                                        ;
   EDIT xbeBRW_ItemSelected MODE DCGUI_BROWSE_EDITDOWN ;
   PRESENTATION aPres

DCBROWSECOL FIELD COLLECT->ORDNO ;
  HEADER "Description" PARENT oBrowse FOOTER '1'

DCBROWSECOL FIELD COLLECT->PROD ;
  HEADER "Type" PARENT oBrowse FOOTER '2'

DCBROWSECOL FIELD COLLECT->DESC ;
  HEADER "SubType" PARENT oBrowse FOOTER '3'

DCBROWSECOL FIELD COLLECT->DESC2 ;
  HEADER "Location" PARENT oBrowse FOOTER '4'

DCBROWSECOL FIELD COLLECT->RELQTY ;
  HEADER "Orig Date" PARENT oBrowse FOOTER '6'

DCBROWSECOL FIELD COLLECT->ORDQTY ;
  HEADER "Acqu Date" PARENT oBrowse FOOTER '7'

DCBROWSECOL FIELD COLLECT->BLQTY ;
  HEADER "Acqu Price" PARENT oBrowse FOOTER '8'

DCBROWSECOL FIELD COLLECT->QTY ;
  HEADER "Appr Value" PARENT oBrowse FOOTER '9'

DCBROWSECOL FIELD COLLECT->CURR ;
  HEADER "Condition" PARENT oBrowse FOOTER '10'

DCBROWSECOL FIELD COLLECT->DODATE ;
  HEADER "Orig Owner?" PARENT oBrowse FOOTER '11'

DCBROWSECOL FIELD COLLECT->TRDATE ;
  HEADER "Comments" PARENT oBrowse ;
  WHEN {||.f.} FOOTER '12'

DCGETOPTIONS TABSTOP

DCREAD GUI ;
   OPTIONS GetOptions ;
   MODAL ;
   TITLE 'Database Browse Demo' ;
   FIT ;
   BUTTONS DCGUI_BUTTON_EXIT ;
   CLEAREVENTS

CLOSE ALL

ReTURN

FUNCTION APPENDHERE()
APPEND BLANK
REPLACE ORDNO WITH '9999', PROD WITH 'ANDY', DESC WITH 'ANDY DESC', DESC2 WITH 'ANDY DESC2'
RETURN NIL

FUNCTION SEEKHERE()
SEEK 'P114475'
RETURN NIL
Any ideas on how to solve this?

Regards,

Andy

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

Re: DCBROWSE Vertical Bar using PGDBE error

#2 Post by rdonnay »

What version of eXpress++ are you using?

I'm sure that I coded around this Xbase++ bug in build 260 and later.
The eXpress train is coming - and it has more cars.

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: DCBROWSE Vertical Bar using PGDBE error

#3 Post by Andy Edward »

Hi Roger,

I'm using Express++ 2.0.261 already. I've read that the newest xBase is 2.0.575, but I'm still at 2.0.554.

I've built the bin20 and lib folders using build20.bat.

All the System/User Variales (PATH, INCLUDE, LIB) already pointing to their respective Express++ sub-folders.

PATH
Untitled-1.gif
Untitled-1.gif (16.62 KiB) Viewed 8053 times
LIB
Untitled-2.gif
Untitled-2.gif (14.59 KiB) Viewed 8053 times
INCLUDE
Untitled-3.gif
Untitled-3.gif (14.64 KiB) Viewed 8053 times
Best Regards,

Andy

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

Re: DCBROWSE Vertical Bar using PGDBE error

#4 Post by rdonnay »

Ok, I will look into this and see what has happened.
The eXpress train is coming - and it has more cars.

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

Re: DCBROWSE Vertical Bar using PGDBE error

#5 Post by rdonnay »

Ok, now I see the problem.

Back in build 260, I added a fix to DC_dbPosition() but not to DC_dbGoPosition().

Here is an updated _DCSCOPE.PRG.
Copy it to your \exp20\source\dclipx folder and run BUILD20.BAT to rebuild dclipx.dll.

These workarounds don't make dbPosition() or dbGoPosition() work with PGDBE.
I cannot do that if Xbase++ can't do it. It only prevents an error.
Attachments
_dcscope.zip
(10.45 KiB) Downloaded 599 times
The eXpress train is coming - and it has more cars.

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: DCBROWSE Vertical Bar using PGDBE error

#6 Post by Andy Edward »

Hi Roger,

Thank you.

Regards,

Andy

Post Reply