Combo Box Events


Recommended Posts

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

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

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

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

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

  • 5 weeks later...

Archived

This topic is now archived and is closed to further replies.