bufere Posted February 17, 2012 Share Posted February 17, 2012 Perhaps the question has already been done, but I would not have found. I would create a "button" to its pressure to give a value of 1 to my variable and its release returns to 0, so to speak not a function of type "toggle between". I hope I have explained the problem correctly, sorry for my bad english. thanks Bufere Link to comment Share on other sites More sharing options...
AzeoTech Posted February 18, 2012 Share Posted February 18, 2012 You'll see if you select the Quick Sequence action for a button (or variable value, descriptive text or symbol component) an option that says "On Mouse Down". To make a button as you describe, create two actions, one with On Mouse Down checked. So: Action #1: On Mouse Down checked myVar = 1 Action #2 On Mouse Down not checked myVar = 0 Link to comment Share on other sites More sharing options...
bufere Posted February 19, 2012 Author Share Posted February 19, 2012 This is what I have make, but does not work. What's wrong? I recently started using your software. Many Tanks for your help. Bufere button.ctl Link to comment Share on other sites More sharing options...
AzeoTech Posted February 20, 2012 Share Posted February 20, 2012 The "On Mouse Down checked" and "On Mouse Down not checked" were instructions, not part of the script. There is only one line of script in each action, the myVar =. Link to comment Share on other sites More sharing options...
silogarrett Posted March 19, 2012 Share Posted March 19, 2012 Guru, This is a great function for a horn, which I have. Now, is there a way to make that same button actuate from a designated key on my keyboard? Mike Link to comment Share on other sites More sharing options...
AzeoTech Posted March 19, 2012 Share Posted March 19, 2012 Sure, use the OnKeyDown and OnKeyUp system events. Activate the horn on key down, and deactivate it on key up. These are actual sequences you will create. You might look at the setFocus sample included in the latest 5.87 release as it uses the OnKeyDown event. Link to comment Share on other sites More sharing options...
silogarrett Posted March 20, 2012 Share Posted March 20, 2012 Hm. I don't see what I'm doing wrong. I created both an OnKeyDown and an OnKeyUp sequence, and as an example of my code, here's what I put in OnKeyDown: if (key == 107) device.ProXR.Write(chra({0xFE,0x07})) return(1) endif return(0) Nothing happens when I'm on a page, as instructed. Is it that I didn't declare OnKeyDown(109,0,0) somewhere? Mike Link to comment Share on other sites More sharing options...
AzeoTech Posted March 20, 2012 Share Posted March 20, 2012 I can't say straight off, but the best thing to do is put: ? key at the top of both Events and then look in the command/alert and see if it says 107 or something different. Link to comment Share on other sites More sharing options...
silogarrett Posted March 20, 2012 Share Posted March 20, 2012 Guru, Works fine this morning. Thank you for your guidance. The OnKeyDown code looks like this, and the OnKeyUp is identical save for the device command: ? key if (key == 107) device.ProXR.Write(chra({0xFE,0x0F})) return(1) endif return(0) Avoid making the OnKeyDown and OnKeyUp sequences auto-starting, as they will throw an error on CTL startup. This really works well for my horn application. Thanks again. The more I learn, the more I love DF! Mike Link to comment Share on other sites More sharing options...
AzeoTech Posted March 20, 2012 Share Posted March 20, 2012 Yeah, system events don't need autostart. You get an error because "key" isn't defined unless its called as an event. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.