May 09, 2024, 04:38:09 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Update Technique

Started by LarryMc, May 04, 2010, 10:18:49 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

I'm looking for an easy to implement, bullet proof techniques for doing updates.

Here's where I need it to work:

When I change an edit control or a radiobutton or a checkbox, etc. a change message is sent to my handler by windows.

In my code I read all my controls load a UDT and store the info.  To make sure all the places I need updated do indeed get updated, I clear and reload all the places the data resided including  the controls that just changed to trigger the update which in turn causes a change message to be generated.

So, if I rely on change messages alone the program will go into a loop until it crashes.

I need some ideas because the ones I've tried so for don't accomplish what I need.

Any ideas out there?

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

celphick

QuoteWhen I change an edit control or a radiobutton or a checkbox, etc. a change message is sent to my handler by windows.

In my code I read all my controls load a UDT and store the info.  To make sure all the places I need updated do indeed get updated, I clear and reload all the places the data resided including  the controls that just changed to trigger the update which in turn causes a change message to be generated.

So, if I rely on change messages alone the program will go into a loop until it crashes.

2 untried suggestions.

Have a separate dummy window/control with its associated subroutine doing the updates and ignore messages from this window/control when it operates.

or

after the update set a flag, ignoring messages when the flag is set. Don't forget to reset the flag.

That's the best I can think of at the moment. I had a similar problem in IBasic days with a sudoku program I made. I used the flag.

Colin.

Rock Ridge Farm (Larry)

Might be awkward but, use a temp file - write all changes to the temp file and read back to memory using a flag.
You can clear and re-write the file as needed or keep a running log of changes for rollback.

Larry