DCCHART Sample

This forum is for eXpress++ general support.
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCCHART Sample

#11 Post by rdonnay »

I noticed from your error log that you are using a very old version of Xbase++ (build 331).

I get completely different results than you do because I don't know what version (builld) of eXpress++ you are using.
You need to tell me this before I can help you.
The eXpress train is coming - and it has more cars.

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

Re: DCCHART Sample

#12 Post by Andy Edward »

Hi Roger,

I'm using Express++ 1.9.260

Regards,

Andy

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

Re: DCCHART Sample

#13 Post by rdonnay »

ok, i see why the change i gave you made no improvement.

You are still using Xbase++ 331 which doesn't support the GetPointerPos() function, therefore the code never even gets compiled. If you put a Sleep(10) where shown below, you will see an improvement.

As far as your error is concerned when clicking the mouse.
I don't get that error if the WTF is removed from the code block.

Code: Select all

#if XPPVER > 1900345
nSeconds := Seconds()
aPos := GetPointerPos()
IF Empty(::toolTipWindow) .OR. !::toolTipWindow:isVisible()
  DO WHILE Seconds() - nSeconds < .3
    aPos1 := GetPointerPos()
    IF aPos1[1] # aPos[1] .OR. aPos1[2] # aPos[2]
      Sleep(0)
      RETURN nil
    ENDIF
  ENDDO
ENDIF
#endif
Sleep(10)  // <<<<<<<<<<<<<<<<<<  add this
The eXpress train is coming - and it has more cars.

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

Re: DCCHART Sample

#14 Post by Andy Edward »

Hi Roger,
rdonnay wrote:As far as your error is concerned when clicking the mouse.
I don't get that error if the WTF is removed from the code block
I received the error not when I click the mouse, but when I start the sample and the mouse moves. Which is from

Code: Select all

oRmChart:mouseMove :={|nMouseButton,b,nX,nY,aData| oRMChart:showToolTip( nMouseButton, nX, nY, aData )}
It will run the :showtooltip method, but when it hits this code in _dcrmcht.prg

Code: Select all

nRegion := aData[5,2]
, it fails. Because aData is nil

I know the aData is nil from putting (wtf aData) in the DCREAD like so.

Code: Select all

DCREAD GUI ;
    SETAPPWINDOW ;
    FIT ;
    TITLE 'DCRMCHART Sample Program' ;
    OPTIONS GetOptions ;
    EVAL {||oRMChart:RMCToolTipWidth := 100, ;
            oRMChart:RMCUserWatermark := 'eXpress++ RMChart System', ;
            oRMChart:RMCUserWMAlignment := RMC_TEXTRIGHT, ;
            oRMChart:RMCUserWMFontSize := 32, ;
            oRMChart:RMCUserWMLucent := 40, ;
            oRmChart:mouseDown := ;
            {|a,b,c,d,e,o|wtf e,  aData := e,nWhich := a,o:=Thread():new(),o:start({||BrowseCallbackData(nWhich,aData,oRMChart)})}, ;
            oRmChart:mouseMove := ;
            {|nMouseButton,b,nX,nY,aData| oRMChart:showToolTip( nMouseButton, nX, nY, aData )}, ;
            oRmChart:draw(), (wtf aData)  }
How can I make sure that that aData is not nil? Isn't aData should be populated from the DCADDBARGROUP, etc commands?

I'm using xbase 1.9.331 and express++ 1.9.260

Regards,

Andy

bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: DCCHART Sample

#15 Post by bwolfsohn »

Andy, i think inside a codeblock, you need to have the wtf in parenthesis.. i.e.

{|o| (wtf e), rest of codeblock here }
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

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

Re: DCCHART Sample

#16 Post by rdonnay »

I just made the following change to _DCRMCHT.PRG.

This change will be in next release.

You should do the same.

Code: Select all

IF Valtype(aData) == 'O' .AND. aData:isDerivedFrom('VtRecord')
  aData := aData:value
ELSE   <<<<<<<<<<<<<<<< add this
  RETURN nil   <<<<<<<<<<<<<<< add this
ENDIF
The eXpress train is coming - and it has more cars.

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

Re: DCCHART Sample

#17 Post by Andy Edward »

Hi Roger,

This is what I come up with to address the memory consumption issue in _dcrmcht.prg.

Note the Sleep(25)

Code: Select all

METHOD DC_XbpRMChart:ShowToolTip( nMouseButton, nX, nY, aData )

LOCAL GetList, GetOptions, nSeriesIndex, nDataIndex, nRegion, oRegion, aPos, ;
      lStatus := .f., nNumLines, nHeight, aColor, nColor, nSeconds, aPos1

Sleep(25)   <<<<<<<<<<<<< without this, this method will return nil (adata is nil) thousands of times per second. Never reaching the sleep(10) below
IF !::toolTipEnable
  RETURN nil
ENDIF

IF Valtype(aData) == 'O' .AND. aData:isDerivedFrom('VtRecord')
  aData := aData:value
ELSE             <<<<<<<<<<<<<<<< add this from Roger
  RETURN nil             <<<<<<<<<<<<<<<< add this from Roger
ENDIF
.
.
.

Now, the memory consumption is very minimal. Thanks Roger for the help and the hints.

Regards,

Andy

Post Reply