IonicWind Software

IWBasic => GUI Central => Topic started by: LarryMc on February 20, 2009, 03:13:07 PM

Title: Disable Notification Messages
Post by: LarryMc on February 20, 2009, 03:13:07 PM
I have a combobox and a group of associated edit controls
When I select an item from the combobox a group of items are read from a listview and the values are loaded into the edit controls.
Much like when reading records from a database in appearence.

When I edit an edit control the value is immediately updated in the listview.
It also tells my program to update a visual custom control real time.

Editing a selected listview 'record' and updating my control works great.

The problem is when I make a new selection with the combo box the loading of the edit controls is sensed as a change (just as if I were typing) and it treats it like I made a change and overwrites the newly selected listview items with the contents of the previous record values.

Is there a way that when I select a combobox item that I can disable the notification messages from all the edit controls until after they have had a chance to be updated from the listview?

I couldn't find anything (that I could recognize) that looked like it would help me out.

Basically I want no message sent when I load an edit control under program control but send the notification messages if I'm typing in the control.

Larry

Title: Re: Disable Notification Messages
Post by: LarryMc on February 20, 2009, 05:57:30 PM
Got it to work doing the following:

created a global flag "enablemsg"
set it initially to 0

in the window handler for the edit controls
SELECT @MESSAGE
   CASE @IDCLOSEWINDOW
      CLOSEWINDOW win
   CASE @IDCONTROL
      SELECT @CONTROLID
         case 1    'edit control 1
         case& 2    'edit control 2
         case& 3    'edit control 3
            if @notifycode = @ENKILLFOCUS then enablemsg=0
            if @notifycode = @ENSETFOCUS then enablemsg=1
            if @notifycode =  @ENCHANGE & enablemsg=1
                 'do the edit control update stuff
      Endselect
endselect

It works because windows kills the focus on a control before setting the focus on the control that was clicked on.
It does it it the correct order.

So, it turned out to be real simple.

Larry