As you can see in the lines below from the output window, it "Kinda" appears to work. There are no errors returned, and a new handle-ID is created / returned. The next statements to set color and size work with no errors, they return 0 (zero). But there is nothing on the chart. A L S O - when I press the Ctrl-mouse key the 2nd time, it creates the same handle #, which tells me something did NOT work. In the log the price, date and time are different, a they should be as I moved the mouse before making the 2nd attempt to create text.
" O u t p u t L o g "
mouse click date time --> 41089.13
JOR_0 a simple numeric var--> 41089.13
Left Ctrl -> Date portion of MouseDtTm = 6/29/2012
Left Ctrl ->Time Portion of MouseDtTm = 3:00:41 AM
price --> 1348.45
handle returned from Text_New_s --> 7.00
return set color --> 0.00
return set size --> 0.00
mouse click date time --> 41089.24
JOR_0 a simple numeric var--> 41089.24
Left Ctrl -> Date portion of MouseDtTm = 6/29/2012
Left Ctrl ->Time Portion of MouseDtTm = 5:50:19 AM
price --> 1332.53
handle returned from Text_New_s --> 7.00
return set color --> 0.00
return set size --> 0.00
========== end of output log
Code: Select all
switch (getappinfo(aicalcreason)) begin
case CalcReason_MouseLClick :
if MouseClickCtrlPressed then begin
JOR_0 = MouseClickDateTime;
print("mouse click date time --> ",MouseClickDateTime);
print("JOR_0 a simple numeric var--> ",JOR_0);
print("Left Ctrl -> Date portion of MouseDtTm = ", DateToString(IntPortion(JOR_0)));
print("Left Ctrl ->Time Portion of MouseDtTm = ", TimeToString(FracPortion(JOR_0)));
print("price --> ", MouseClickPrice);
JOR_Txt_Hndl = text_new_s( JOR_0,JOR_0,MouseClickPrice,"sample text");
print("handle returned from Text_New_s --> ", JOR_Txt_Hndl);
JOR_0 = text_setcolor(JOR_Txt_Hndl, yellow);
print("return set color --> ", JOR_0);
JOR_0 = text_setsize(JOR_Txt_Hndl, 16);
print("return set size --> ",JOR_0);
// JOR_1 = text_new_s( Intportion(JOR_0),FracPortion(JOR_0),MouseClickPrice,JOR_Text);
// if JOR_Text = "a3" then JOR_Text = "b3";
// if JOR_Text = "b3" then JOR_Text = "c3";
end { if MouseClickCtrlPressed & CalcReason_MouseLClick }
again thanks in advance for suggestions or catching an error.
John Romero