From: The D. <the...@bl...> - 2005-07-21 19:47:56
|
John Labenski <jla...@gm...> wrote: (21/07/2005 18:37) >I'm glad it helped, but sometimes a little more code would make the >descriptions more clear. For example, what did you have that made the >event:ControlDown() not work, maybe it was just a typo or something. > Sort of.. I had a wxEVT_COMMAND_BUTTON_CLICKED amongst the set of mouse events, and tried to make it work there, which it can't. I fixed it by making it a wxEVT_LEFT_UP and using Skip() afterwards to make sure the buttons worked right. >> In other words, for a framework for adding an example, the easiest way that might help others as well as me might be to reach for whichever exiisting wxLua example is currently supplied with the distribution, and work it into that. > >That was what I was thinking. > What I forgot to add was the word 'you'.. :) If I'm not sure of something, it's quite possible I overlooked a context error, as in the most recent case. In that instance, the best correction would be for you to show the right working context. That was what was so valuable in your recent example. I usually catch my errors, but sometimes I get lost enough that after some hours I'll ask instead of thrashing around further.. I could show you my error, but I doubt that would be as useful as seeing the right method working. Besides, if I don't yet recognise my error this might be hard to do. :) In the last case I only realised it after seeing how your example worked. >> I'm really hoping for wxLua to have libraries written so MIDI and audio signals can be handled. > >That will be something you'll have to do unfortunately. > I don't know how. If I need to learn C I doubt I ever will. Also, if I had to get that deep into C that would sort of defeat the point of using wxLua.. :) --------------------------------- Lastly, another question.. How would I make a tool, to be later added to a toolbar? I want to assign it to a variable so I can get direct access to mouse events on it. I've seen that tools can be added later, but nothing to show how to make them in advance of this. My context: TBAR:ConnectEvent(-1,wx.wxEVT_LEFT_UP, function(EV) if (EV:ControlDown()) then DoThings() end EV:Skip() end ) In the above code, I can use DoThings() to set a global variable as a flag, then test that flag during the handling for the tool, as this flag would be set on ControlDown() for any toolbar click, whether on a tool or not. This is awkward though, as I'll have to think of ways to reset that flag if anything else on the toolbar was clicked with the Ctrl key held. I added a control (bitmap button; as test, aesthetically it sucked), and that works as I want, but AddTool() doesn't seem to have any way to assign the tool to a variable while adding it. If it did, I could replace TBAR in the above code with that variable name, as I did for my test control button, solving the problem very neatly. I did try ZZ=TBAR:AddTool(wx.wxID_SAVE...) but although ZZ exists, as userdata, it's not the kind of userdata I need, I can't get an ID out of it, and such.. I haven't even found out yet what ZZ actually is. :) I also tried replacing the -1 in the above code with the ID of the button I wanted, but that doesn't work. The button works, but not the ControlDown bit. If I try wx.wxID_TOOLBAR it's very unhappy, says invalid ID. :) Can't help wondering what ID the toolbar is using if it's not that one, as that's what I assigned to it in the first place. Mystifying.. Thanks for the help, it's given me a day of useful effort, which is more than the previous session acheived. Crow. |