Hi,
is there anybody who is using FF together with the rmchart.dll?
I want do catch a klick-event on a chart, but how?
In the helpfile of RMCart they use a CALLBACK FUNCTION
Dialog Show Modal hDlg Call ShowDialogRMCCallback 'to the
How can i do this with FF? :?:
thanks for any help
Rudolf
I haven't used it, but I downloaded it and made a simple FireFly project based on the example code and Help file info.
Add the "rmchart.inc" include file into the FireFly project via "Add Module".
The only difference in the example code is that it uses Callbacks based on PB's DDT type of syntax. Translating this to WinAPI is extremely easy because all you need to do is create the chart in WM_CREATE and then handle all other messages in the CUSTOM message handler in FireFly.
The following example should show what I mean. (Note that I don't use the CBLPARAM, CBCTLMSG, CBCTL, etc... but rather the WinAPI equivalents based on the incoming message).
%ID_RMC1 = %WM_USER+1024
'------------------------------------------------------------------------------------------------------------------------
Function FORM1_WM_CREATE ( _
hWndForm As Dword, _ ' handle of Form
ByVal UserData As Long _ 'optional user defined Long value
) As Long
LOCAL nC AS LONG
LOCAL nRetval AS LONG
LOCAL sTemp AS STRING
REDIM asTemp(0) AS STRING
REDIM aData(0) AS DOUBLE
' This example uses the short notation style (no UDTs) and omits
' all default properties, so the code is quite small
nRetVal = RMC_CreateChart(hWndForm,%ID_RMC1,10,10,600,450) ' create the chart control
nRetVal = RMC_AddRegion(%ID_RMC1) ' add a Region to the chart
nRetval = RMC_AddCaption(%ID_RMC1,1,"This is the chart's caption",%ColorBlue,%ColorYellow,11,%TRUE) ' add a Caption to region 1
nRetval = RMC_AddGrid(%ID_RMC1,1,%ColorBeige,0,0,0,0,0,%RMC_BICOLOR_LABELAXIS) ' add a Grid to region 1
nRetval = RMC_AddDataAxis(%ID_RMC1,1,%RMC_DATAAXISLEFT,0,100,11) ' add a Data axis to region 1
nRetval = RMC_AddLabelAxis(%ID_RMC1,1, "Label 1*Label 2*Label 3*Label 4*Label 5",1)' add a Label axis to region 1
RMC_SetLAXLineStyle %ID_RMC1,1,%RMC_LINESTYLENONE ' No lines for the label axis
sTemp = "50*70*40*60*30"
nC = RMC_Split2Double(sTemp, aData()) ' read data values into array
nRetval = RMC_AddBarSeries(%ID_RMC1,1, aData(0),nC,%RMC_BARSINGLE,%RMC_BAR_FLAT_GRADIENT1) ' add a Bar series to region 1
' all bars have as default the same color, but:
nRetval = RMC_SetSeriesColor(%ID_RMC1,1,1,%ColorRed,3) ' bar #3 gets Red
FUNCTION = nRetVal
IF nRetVal < 0 THEN EXIT FUNCTION ' Error?
RMC_Draw %ID_RMC1 ' Draw the chart
End Function
'------------------------------------------------------------------------------------------------------------------------
Function FORM1_CUSTOM ( _
hWndForm As Dword, _ ' handle of Form
wMsg As Long, _ ' type of message
wParam As Dword, _ ' first message parameter
lParam As Long _ ' second message parameter
) As Long
Local TINFO As tRMC_INFO Pointer
Static z As Long
Select Case wMsg
Case %WM_RBUTTONDOWN ' right mouse button was clicked
' lParam holds always the X/Y-position within the dialog,
' even you've clicked onto the chart
MsgBox "X-Pos in the dialog:"+Str$(LoWrd(lParam))+$CrLf+ _
"Y-Pos in the dialog:"+Str$(HiWrd(lParam))
Case %WM_COMMAND
Select Case LoWrd(wParam) ' ID of the control sending the notification
Case %ID_RMC1 'message from the chart control
Select Case HiWrd(wParam) 'identify the message
Case %RMC_LBUTTONDOWN 'left mouse button
z = 1 'set flag for left mouse button pressed
Case %RMC_LBUTTONUP
z = 0 'reset the flag for left mouse button pressed
Case %RMC_CTRLRBUTTONDOWN 'Ctrl and right mouse button
TINFO = lParam 'CBLPARAM holds a pointer to a tRMC_INFO structure
MsgBox "X-Pos in the chart:"+Str$(@TINFO.nXPos)+$CrLf+ _
"Y-Pos in the chart:"+Str$(@TINFO.nYPos)
Case %RMC_MOUSEMOVE 'mouse was moved in the chart control
TINFO = lParam 'CBLPARAM holds a pointer to a tRMC_INFO structure
If z Then 'if the left mouse button is pressed
'move the chart control within your dialog
RMC_SetCtrlpos %ID_RMC1,@TINFO.nXMove,@TINFO.nYMove,1
End If
End Select
End Select
End Select
End Function
Thanks Paul for your help. :D
I'll try it next week.
Rudolf