Placing Cursors on an Image - how to?
aahemm
Hello
again a "problem" of a programming newbie ...
I'm trying to place cursors on an Image using a GUI. I create a GUI using a first function. A panel with an image and a button. A click on the button should add 2 cursors to the image. Therefor I wrote this code but it is not possible to get the cursors.
Static Function init()
...
NewImage /N=G0 /HOST=# $calibImg
ModifyImage $calibImg ctab= {*,*,Grays,0}
ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14
ModifyGraph mirror=2
ModifyGraph nticks(left)=8,nticks(top)=4
ModifyGraph minor=1
ModifyGraph fSize=9
ModifyGraph standoff=0
ModifyGraph tkLblRot(left)=90
ModifyGraph btLen=3
ModifyGraph tlOffset=-2
SetAxis/A/R left
SetActiveSubwindow ##
End
...
Static Function btn_drawline(CtrlName):ButtonControl
String CtrlName
Cursor /A=1 /C=(65535,0,0) /F /H=3 /I A G0 0,0
Cursor /A=1 /C=(65535,0,0) /F /H=3 /I B G0 1,1
End
...
NewImage /N=G0 /HOST=# $calibImg
ModifyImage $calibImg ctab= {*,*,Grays,0}
ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14
ModifyGraph mirror=2
ModifyGraph nticks(left)=8,nticks(top)=4
ModifyGraph minor=1
ModifyGraph fSize=9
ModifyGraph standoff=0
ModifyGraph tkLblRot(left)=90
ModifyGraph btLen=3
ModifyGraph tlOffset=-2
SetAxis/A/R left
SetActiveSubwindow ##
End
...
Static Function btn_drawline(CtrlName):ButtonControl
String CtrlName
Cursor /A=1 /C=(65535,0,0) /F /H=3 /I A G0 0,0
Cursor /A=1 /C=(65535,0,0) /F /H=3 /I B G0 1,1
End
The init-function works nice but when clicking the button it does not add the cursors. It just states
While executing Cursor, the following error occurred: there are no graphs or the specified graph does not exist
What am I doing wrong this time? And how can I move/position the image when using "NewImage"-Command? Or do I have to use DoWindow & AppendImage but then there is no /N=Name flag right?
Thank you guys.
Axel.
Use Cursor/W=Panel0#G0 or something similar. Your command is trying to put cursors on a top level graph instead of the graph subwindow in the panel.
August 2, 2018 at 12:22 pm - Permalink