May 01, 2024, 04:30:07 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Disable Notification Messages

Started by LarryMc, February 20, 2009, 03:13:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

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

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

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library