Support Board
Date/Time: Sun, 06 Jul 2025 06:26:07 +0000
Post From: KeyboardKeyEventCode + PointerEventType
[2019-03-14 15:33:22] |
User462086 - Posts: 196 |
I'm starting to play with ASCIL. My idea is to write the word "SUCCESS" to the message log when the left mouse button is clicked while the SHIFT + S buttons are being held down simultaneously. Each event is being caught individually, and both the keyboard events are caught when both keys are pressed and held down. However, the combination of the 3 events doesn't print "SUCCESS" as expected. Does anyone know how to get this working? Many thanks!! // The top of every source code file must include this line #include "sierrachart.h" // For reference, refer to this page: // Advanced Custom Study Interface and Language (ACSIL) // This line is required. Change the text within the quote // marks to what you want to name your group of custom studies. SCDLLName("My First Custom DLL") //This is the basic framework of a study function. Change the name 'TemplateFunction' to what you require. SCSFExport scsf_MyFirstCustomDLL(SCStudyInterfaceRef sc) { SCString MessageText; // Set configuration variables if (sc.SetDefaults) { sc.GraphName = "My First Custom DLL"; sc.StudyDescription = ""; sc.GraphRegion = 0; // We have expressly set Autolooping to off because we are not filling // in any of the Subgraph[].Data[] arrays. Since Autolooping will // cause this function to be called for every bar in the chart it // would be inefficient to use Autolooping. sc.AutoLoop = 0; sc.ReceiveKeyboardKeyEvents = 1; sc.SupportKeyboardModifierStates = 1; sc.ReceivePointerEvents = ACS_RECEIVE_POINTER_EVENTS_ALWAYS; return; } // wait for an event bool shiftPressed = sc.IsKeyPressed_Shift; bool sPressed = sc.KeyboardKeyEventCode == 83; bool lClick = sc.PointerEventType == SC_POINTER_BUTTON_DOWN; if( shiftPressed ){ sc.AddMessageToLog("Shift Pressed", 0); } if( sPressed ){ sc.AddMessageToLog("S Pressed", 0); } if( lClick ){ sc.AddMessageToLog("Left Click", 0); } if( shiftPressed && sPressed ){ if( lClick ){ sc.AddMessageToLog("SUCCESS", 0); } } } |