Page 2 of 2
Re: DCCHART Sample
Posted: Tue Jul 21, 2015 6:37 am
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.
Re: DCCHART Sample
Posted: Tue Jul 21, 2015 6:40 am
by Andy Edward
Hi Roger,
I'm using Express++ 1.9.260
Regards,
Andy
Re: DCCHART Sample
Posted: Tue Jul 21, 2015 8:30 am
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
Re: DCCHART Sample
Posted: Tue Jul 21, 2015 11:59 pm
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
, 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
Re: DCCHART Sample
Posted: Wed Jul 22, 2015 6:10 am
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 }
Re: DCCHART Sample
Posted: Wed Jul 22, 2015 6:13 am
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
Re: DCCHART Sample
Posted: Wed Jul 22, 2015 9:44 pm
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