The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Mouse Position. MarkerGraphObject

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
dkudlay Posted - 12/07/2009 : 7:12:21 PM
I am trying to get precise point information about a contour graph. I could not find anything that would let me get mouse coordinates. I attempted to use the MarkerGraphObject but I have some issues with it.

1) I can't keep only 1 marker object with out setting Attach to 0 (Page) and then setting a negative value for position.

2) My script is never called.

Here is the code.

void AddProfileCross(GraphLayer gl)
{
MarkerGraphObject mObj;
mObj = gl.GraphObjects("Marker");
if( !mObj )
mObj = gl.CreateGraphObject(GROBJ_TN_MARKER);

mObj.SetName("CrossHair");

vector vX = {0, 0};
vector vY = {0, -10};
mObj.SetPoints(vX, vY);
mObj.Attach = 2; // attach to axes scales

TreeNode trFormat = mObj.GetFormat(FPB_ALL, FOB_ALL, true, true);

// 2 circle
// 3 tri up
// 4 tri down
// 5 diamond
// 6 <
// 7 tri >
// 8 hex
// 9 star
trFormat.Root.Symbol.Shape.nVal = 2; // star
trFormat.Root.Symbol.Size.nVal = 20;
trFormat.Root.Symbol.EdgeColor.nVal = SYSCOLOR_RED;
trFormat.Root.Symbol.FillColor.nVal = SYSCOLOR_GREEN;
trFormat.Root.Color.nVal = -4; // to suppress line drawing between the point
trFormat.Root.Script.strVal = "Crosshair(CrossHair.X, CrossHair.Y)";
trFormat.Root.Event.nVal = GRCT_MOVE;

mObj.UpdateThemeIDs(trFormat.Root);

//trFormat.Root.States.nVal = GOC_NO_SELECT; // so that it does not respond to mouse clicks
mObj.ApplyFormat(trFormat, TRUE, TRUE);

}

void Crosshair(double x, double y)
{
out_str("Called crosshair");
int j = x;
int k = y;

j -= k;
}
4   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 12/11/2009 : 12:44:31 AM
Hi,

A new example Origin C code to create a screen reader with a box and crosshair inside has been added. Please refer to the following page.

http://ocwiki.originlab.com/index.php?title=OriginC:General_Screen_Reader_by_Graph_Object

Penn
OriginLab Technical Services
cpyang Posted - 12/09/2009 : 10:29:46 PM
We will work on providing an example OC code to create a box with a crosshair inside. The box will not be resizable but the mouse dragging will not carry the crosshair along until you release the mouse. Once you move it to be close enough, using arrow key to move the box WILL carry the crosshair along. We can improve later so that crosshair can also be dragged together with the box.

Will post OC code later today or tomorrow.


CP
dkudlay Posted - 12/08/2009 : 5:42:35 PM
Hi Iris, What I am trying to do is to get the X-Axis and Y-Axis value at the crosshair point, so then I can reference it into our data set and display all relevant data for the particular point in text objects (a data legend) on the graph.

Alternatively, I was planning on using a small rect, provided there is a way to make it non-resizable. I thought also about linking lines but I did not see that is was possible to move 2 lines (for a cross) at the same time..

Thank you,
Iris_Bai Posted - 12/08/2009 : 01:15:25 AM
Hi,

MarkerGraphObject class need to attach to one data plot, SetPoints and GetPoints used to get the points on this data plot. But for Contour plot, if you want to get the position of one point, need to use screen reader to read the position of screen. There is not a proper mechanism in Origin C, but you can call Labtalk command "dotool" in Origin C.

Activate one contour graph, and then run "dotool 2" in Command window or Origin C function like

void testPage()
{
	GraphLayer gl = Project.ActiveLayer();
	if( gl )
	{
		LT_execute("dotool 2");
	}
}


Please try and tell me this way if enough for you.


Iris

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000