Robyn Posted May 23, 2012 Share Posted May 23, 2012 Do events work on combo boxes? I have been struggling to get a left button up event to do something, does not seem to work with edit boxes either? Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted May 23, 2012 Share Posted May 23, 2012 No, neither of those components support events. What are you trying to achieve? Maybe there is another way to achieve it... Link to comment Share on other sites More sharing options...
Robyn Posted May 24, 2012 Author Share Posted May 24, 2012 I have a lot of combo and time select boxes on a page. I need to know if any changes are made while the page is displayed or before another set of data is displayed so that I can prompt with a 'Save or Cancel' prompt. Seems to me that if I set up a On Left Mouse Button Up event for every one I could detect this Link to comment Share on other sites More sharing options...
AzeoTech Posted May 24, 2012 Share Posted May 24, 2012 My recommendation is to use a class to hold all the values: class myClass local string x local string y endclass global settings = new(myClass) Then when you go to the page for edits you do: global tempSettings = fromJson(settings.toJson()) this will make a copy of the global settings object. Your edit and combo boxes should work with tempSettings, so tempSettings.x, or tempSettings.y. Then, you can add a cancel/save button. If they click cancel, just change the page since any edits would be to tempSettings, not settings. If they hit save, do: settings = fromJson(tempSettings.toJson()) to copy it back. If you want to check for changes, just compare the json'ed versions of the two: if (settings.toJson() != tempSettings.toJson()) // some change was made I've attached a sample that shows this working. usingClassesForEditPages.ctl Link to comment Share on other sites More sharing options...
Robyn Posted May 28, 2012 Author Share Posted May 28, 2012 Is there a write up on classes anywhere? Can't find it in the User Guide. The above ctl file does not work for me, I get an error saying it is corrupt or from a newer version of DAQFactory. Thanks Robyn Link to comment Share on other sites More sharing options...
Robyn Posted May 28, 2012 Author Share Posted May 28, 2012 Is there a reason why the events should not work on some of these components? It would seem the logical thing to do to capture changes as they are made and do something with them. I am trying to work with setting up a timetable with several entries in each time slot, as entries are added or deleted I would like to reflect the latest data, currently I am just putting a loop in the background and comparing the thing every few seconds to pick up changes but this seems a bit ham fisted Thanks Robyn Link to comment Share on other sites More sharing options...
AzeoTech Posted May 28, 2012 Share Posted May 28, 2012 You are probably running on older release of DAQFactory. That is why you can't open the sample. OOP remains an undocumented feature, despite the fact that I recommend it all the time for advanced users. Details are available on this forum. Search for "class" or "OOP" or the like. As for the reason the events don't work: the combo and edit box are actually Windows components. They are drawn statically by DAQFactory, but when you click on them, an actual Window's control is displayed on top of the screen allowing you to interact with it. Alas, since Windows is handling the events, they aren't passed to DAQFactory and thus don't trigger the component events. I know its not exactly perfect, but unfortunately is the result of a program that has been evolving for 11 years now. We are endeavoring to clean up these areas of inconsistencies, but unfortunately for now you'll have to use the ham fisted techniques. BTW: run that sequence at Idle thread priority and it will have virtual now drain on the responsiveness of your application. Link to comment Share on other sites More sharing options...
Robyn Posted May 28, 2012 Author Share Posted May 28, 2012 I suspect I am using the latest version Pro Release 5.87 Build 1969 Link to comment Share on other sites More sharing options...
AzeoTech Posted May 29, 2012 Share Posted May 29, 2012 No, there is actually one slightly newer release, 5.87a, build 1972. The file is not backwards compatible even with 5.87. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 27, 2012 Share Posted June 27, 2012 Note, I have split off the discussion on to/fromJson and put it in the Sequences forum as a fresh topic. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.