1. w32HChange event on RichEdit

Hi,

How do I trap w32HChange event for a RichEdit control?

Does this event work for RichEdit, as default _onChange() handler does not get
invoked.

Regards,
Rad.

new topic     » topic index » view message » categorize

2. Re: w32HChange event on RichEdit

Rad wrote:
> 
> Hi,
> 
> How do I trap w32HChange event for a RichEdit control?
> 
> Does this event work for RichEdit, as default _onChange() handler does not get
> invoked.
> 
> Regards,
> Rad.

You'll have to instruct the control to issue the EN_CHANGE notification,
on which the library fires w32HChange. By default, the control doesn't
send any EN_* notification.

atom flags,void
flags=sendMessage(myRichId,EM_GETEVENTMASK,0,0)
flags=or_bits(flags,ENM_CHANGE)
void=sendMessage(myRichId,EM_SETEVENTMASK,0,flags)


new topic     » goto parent     » topic index » view message » categorize

3. Re: w32HChange event on RichEdit

CChris wrote:
> 
> You'll have to instruct the control to issue the EN_CHANGE notification,
> on which the library fires w32HChange. By default, the control doesn't
> send any EN_* notification.
> 
> }}}
<eucode>
> atom flags,void
> flags=sendMessage(myRichId,EM_GETEVENTMASK,0,0)
> flags=or_bits(flags,ENM_CHANGE)
> void=sendMessage(myRichId,EM_SETEVENTMASK,0,flags)
> </eucode>
{{{


Hi CChris,

I am getting "has not been declared" error for EM_GETEVENTMASK and
EM_SETEVENTMASK.

I checked in win32lib.ew, where EN_CHANGE is declared, but above 2 variables are
not present.
I am using win32lib includes from IDEwin32lib 0.60.6. (Judith's IDE) Is this the
latest one?
What are the values for EM_GETEVENTMASK and EM_SETEVENTMASK which I can declare
in win32lib.ew?

Regards,
Rad.

new topic     » goto parent     » topic index » view message » categorize

4. Re: w32HChange event on RichEdit

Rad wrote:
> 
> CChris wrote:
> > 
> > You'll have to instruct the control to issue the EN_CHANGE notification,
> > on which the library fires w32HChange. By default, the control doesn't
> > send any EN_* notification.
> > 
> > }}}
<eucode>
> > atom flags,void
> > flags=sendMessage(myRichId,EM_GETEVENTMASK,0,0)
> > flags=or_bits(flags,ENM_CHANGE)
> > void=sendMessage(myRichId,EM_SETEVENTMASK,0,flags)
> > </eucode>
{{{

> 
> Hi CChris,
> 
> I am getting "has not been declared" error for EM_GETEVENTMASK and
> EM_SETEVENTMASK.
> 
> I checked in win32lib.ew, where EN_CHANGE is declared, but above 2 variables
> are not present.
> I am using win32lib includes from IDEwin32lib 0.60.6. (Judith's IDE) Is this
> the latest one? 
> What are the values for EM_GETEVENTMASK and EM_SETEVENTMASK which I can
> declare
> in win32lib.ew?
> 
> Regards,
> Rad.

ENM_CHANGE is 1 (Google is your friend). I think the ENM constants are the
same as the corresponding EN_ ones, but I didn't check.
You'll have to define constants:
EM_GETEVENTMASK = #0459
EM_SETEVENTMASK = #0469

v0.60.6 is the latest version, and Judith's is an adaptation to IDE, 
specially for Win98 users. There may be a newer release some weeks ahead.

CChris

new topic     » goto parent     » topic index » view message » categorize

5. Re: w32HChange event on RichEdit

CChris wrote:
> 
> ENM_CHANGE is 1 (Google is your friend). I think the ENM constants are the
> same as the corresponding EN_ ones, but I didn't check.
> You'll have to define constants:
> EM_GETEVENTMASK = #0459
> EM_SETEVENTMASK = #0469
> 
> v0.60.6 is the latest version, and Judith's is an adaptation to IDE, 
> specially for Win98 users. There may be a newer release some weeks ahead.
> 
> CChris

Hi CChris,

In win32lib.ew, EN_CHANGE has been declared as #300, and I declared -

ENM_CHANGE = 1
EM_GETEVENTMASK = #0459
EM_SETEVENTMASK = #0469



I used EM_GETEVENTMASK and EM_SETEVENTMASK as follows:

In General area of window:

atom flags, void

flags = sendMessage(RichEdit41, EM_GETEVENTMASK, 0, 0)
flags = or_bits(flags, ENM_CHANGE) -- also tried EN_CHANGE
void = sendMessage(RichEdit41, EM_SETEVENTMASK, 0, flags)


In w32HChange area for RichEdit41:

procedure RichEdit41_onChange (integer self, integer event, sequence
params)--params is ()
	VOID = message_box("RichEdit Changed", "onChange", MB_ICONINFORMATION)
end procedure
setHandler( RichEdit41, w32HChange, routine_id("RichEdit41_onChange"))


But still I can not get the display from w32HChange event for RichEdit41.
Where am I going wrong?

Regards,
Rad.

new topic     » goto parent     » topic index » view message » categorize

6. Re: w32HChange event on RichEdit

Rad wrote:
> 
> CChris wrote:
> > 
> > ENM_CHANGE is 1 (Google is your friend). I think the ENM constants are the
> > same as the corresponding EN_ ones, but I didn't check.
> > You'll have to define constants:
> > EM_GETEVENTMASK = #0459
> > EM_SETEVENTMASK = #0469
> > 
> > v0.60.6 is the latest version, and Judith's is an adaptation to IDE, 
> > specially for Win98 users. There may be a newer release some weeks ahead.
> > 
> > CChris
> 
> Hi CChris,
> 
> In win32lib.ew, EN_CHANGE has been declared as #300, and I declared -
> 
> ENM_CHANGE = 1
> EM_GETEVENTMASK = #0459
> EM_SETEVENTMASK = #0469
> 
> 
> I used EM_GETEVENTMASK and EM_SETEVENTMASK as follows:
> 
> In General area of window:
> 
> }}}
<eucode>
> atom flags, void
> 
> flags = sendMessage(RichEdit41, EM_GETEVENTMASK, 0, 0)
> flags = or_bits(flags, ENM_CHANGE) -- also tried EN_CHANGE
> void = sendMessage(RichEdit41, EM_SETEVENTMASK, 0, flags)
> </eucode>
{{{

> 
> In w32HChange area for RichEdit41:
> 
> }}}
<eucode>
> procedure RichEdit41_onChange (integer self, integer event, sequence
> params)--params is ()
> 	VOID = message_box("RichEdit Changed", "onChange", MB_ICONINFORMATION)
> end procedure
> setHandler( RichEdit41, w32HChange, routine_id("RichEdit41_onChange"))
> </eucode>
{{{

> 
> But still I can not get the display from w32HChange event for RichEdit41.
> Where am I going wrong?
> 
> Regards,
> Rad.

Damn you are right, this is trapped by the lib for edit boxes only.
There's a quick fix (line #s refer to official win32lib v0.60.6):
* at line 30548, there's a line that says
{w32HChange,  w32CHG_Chg},   -- editbox notify change

Add below it:
{w32HChange,  w32CHG_Chg},   -- RichEdit notify change

Likewise, line 30537 says
{EDIT,EN_CHANGE},      -- editbox notify change

Add below this:
{COMMON_CONTROL,EN_CHANGE},      -- RichEdit (and others) notify change

This is not the cleanest way, but it will work (I just checked that the
notification is indeed received by the parent, it's just that the library
currently ignores it).

CChris

new topic     » goto parent     » topic index » view message » categorize

7. Re: w32HChange event on RichEdit

CChris wrote:
> 
> Damn you are right, this is trapped by the lib for edit boxes only.
> There's a quick fix (line #s refer to official win32lib v0.60.6):
> * at line 30548, there's a line that says
> }}}
<eucode>
>     {w32HChange,  w32CHG_Chg},   -- editbox notify change
> </eucode>
{{{

> Add below it:
> }}}
<eucode>
>     {w32HChange,  w32CHG_Chg},   -- RichEdit notify change
> </eucode>
{{{

> Likewise, line 30537 says
> }}}
<eucode>
>     {EDIT,EN_CHANGE},      -- editbox notify change
> </eucode>
{{{

> Add below this:
> }}}
<eucode>
>     {COMMON_CONTROL,EN_CHANGE},      -- RichEdit (and others) notify change
> </eucode>
{{{

> This is not the cleanest way, but it will work (I just checked that the
> notification is indeed received by the parent, it's just that the library
> currently ignores it).
> 
> CChris

Hi CChris,

Still something is missing.

Added the required lines in win32lib.ew, but still not getting _onChange()
invoked.

EM_GETTEXTEX  = WM_USER + 94,
    EM_GETTEXTLENGTHEX = WM_USER + 95,
-- rad 2007-05-02
    ENM_CHANGE = 1,
    EM_GETEVENTMASK = #0459,
    EM_SETEVENTMASK = #0469,
-- rad 2007-05-02
    TM_PLAINTEXT                        = 1,
    TM_RICHTEXT                                = 2,

constant kMsgCommandCode = {
    {BUTTON,BN_CLICKED},     -- Button click
    {STATIC,STN_CLICKED},    -- Label(static) click
    {LISTBOX,LBN_SELCHANGE},  -- combo/list box selection change
    {EDIT,EN_CHANGE},      -- editbox notify change
-- rad 2007-05-03
    {COMMON_CONTROL,EN_CHANGE}, -- RichEdit (and others) notify change
-- rad 2007-05-03
    {COMBO,CBN_EDITCHANGE}, -- combo notify change has occured
    {COMBO,CBN_SELCHANGE},  -- combo/list box notify change
    {COMBO,CBN_DROPDOWN},   -- The combobox is about to dropdown.
    {COMBO,CBN_CLOSEUP}     -- The combobox dropdown has just been closed
    }

constant kW32EventCode = {
    {w32HClick,   0},    -- Button
    {w32HClick,   0},    -- Label Click
    {w32HChange,  w32CHG_Sel},   -- list box notify change
    {w32HChange,  w32CHG_Chg},   -- editbox notify change
-- rad 2007-05-03
    {w32HChange,  w32CHG_Chg},   -- RichEdit notify change
-- rad 2007-05-03
    {w32HChange,  w32CHG_Chg},   -- combo data changed
    {w32HChange,  w32CHG_Sel},   -- combo selection changed
    {w32HDropDown,0}, -- combo is about to dropdown.
    {w32HCloseUp, 0}   -- combo dropdown has just been closed
    }



Anything else has to be changed/included?

Tried suggested line additions in both IDE as well as official win32lib.ew, but
getting same result.
(in official version, the line numbers were at 30538 and 30527 instead of 30548
and 30537 respectively.)

I am using WinXP SP2, hope noting to do with this.

Regards,
Rad.

new topic     » goto parent     » topic index » view message » categorize

8. Re: w32HChange event on RichEdit

Rad wrote:
> 
> CChris wrote:
> > 
> > Damn you are right, this is trapped by the lib for edit boxes only.
> > There's a quick fix (line #s refer to official win32lib v0.60.6):
> > * at line 30548, there's a line that says
> > }}}
<eucode>
> >     {w32HChange,  w32CHG_Chg},   -- editbox notify change
> > </eucode>
{{{

> > Add below it:
> > }}}
<eucode>
> >     {w32HChange,  w32CHG_Chg},   -- RichEdit notify change
> > </eucode>
{{{

> > Likewise, line 30537 says
> > }}}
<eucode>
> >     {EDIT,EN_CHANGE},      -- editbox notify change
> > </eucode>
{{{

> > Add below this:
> > }}}
<eucode>
> >     {COMMON_CONTROL,EN_CHANGE},      -- RichEdit (and others) notify change
> > </eucode>
{{{

> > This is not the cleanest way, but it will work (I just checked that the
> > notification is indeed received by the parent, it's just that the library
> > currently ignores it).
> > 
> > CChris
> 
> Hi CChris,
> 
> Still something is missing.
> 
> Added the required lines in win32lib.ew, but still not getting _onChange()
> invoked.
> 
> }}}
<eucode>
>     EM_GETTEXTEX  = WM_USER + 94,
>     EM_GETTEXTLENGTHEX = WM_USER + 95,
> -- rad 2007-05-02
>     ENM_CHANGE = 1,
>     EM_GETEVENTMASK = #0459,
>     EM_SETEVENTMASK = #0469,
> -- rad 2007-05-02
>     TM_PLAINTEXT                        = 1,
>     TM_RICHTEXT                                = 2,
> 
> constant kMsgCommandCode = {
>     {BUTTON,BN_CLICKED},     -- Button click
>     {STATIC,STN_CLICKED},    -- Label(static) click
>     {LISTBOX,LBN_SELCHANGE},  -- combo/list box selection change
>     {EDIT,EN_CHANGE},      -- editbox notify change
> -- rad 2007-05-03
>     {COMMON_CONTROL,EN_CHANGE}, -- RichEdit (and others) notify change
> -- rad 2007-05-03
>     {COMBO,CBN_EDITCHANGE}, -- combo notify change has occured
>     {COMBO,CBN_SELCHANGE},  -- combo/list box notify change
>     {COMBO,CBN_DROPDOWN},   -- The combobox is about to dropdown.
>     {COMBO,CBN_CLOSEUP}     -- The combobox dropdown has just been closed
>     }
> 
> constant kW32EventCode = {
>     {w32HClick,   0},    -- Button
>     {w32HClick,   0},    -- Label Click
>     {w32HChange,  w32CHG_Sel},   -- list box notify change
>     {w32HChange,  w32CHG_Chg},   -- editbox notify change
> -- rad 2007-05-03
>     {w32HChange,  w32CHG_Chg},   -- RichEdit notify change
> -- rad 2007-05-03
>     {w32HChange,  w32CHG_Chg},   -- combo data changed
>     {w32HChange,  w32CHG_Sel},   -- combo selection changed
>     {w32HDropDown,0}, -- combo is about to dropdown.
>     {w32HCloseUp, 0}   -- combo dropdown has just been closed
>     }
> </eucode>
{{{

> 
> 
> Anything else has to be changed/included?
> 
> Tried suggested line additions in both IDE as well as official win32lib.ew,
> but getting same result.
> (in official version, the line numbers were at 30538 and 30527 instead of
> 30548
> and 30537 respectively.)
> 
> I am using WinXP SP2, hope noting to do with this.
> 
> Regards,
> Rad.

Gotcha! My bad.
EM_GETEVENTMASK is WM_USER+59 actually (that would be #043B), and
EM_SETEVENTMASK
is WM_USER+69, ie #0445. Hate these mixed hex/decimal. Or I'm too used to hex.
With these right definitions, under XP SP2 pro, the event does fire.

CChris

new topic     » goto parent     » topic index » view message » categorize

9. Re: w32HChange event on RichEdit

CChris wrote:
> 
> Gotcha! My bad.
> EM_GETEVENTMASK is WM_USER+59 actually (that would be #043B), and
> EM_SETEVENTMASK
> is WM_USER+69, ie #0445. Hate these mixed hex/decimal. Or I'm too used to hex.
> With these right definitions, under XP SP2 pro, the event does fire.
> 
> CChris

Thanks CChris,

After changing EM_GETEVENTMASK and EM_SETEVENTMASK to their correct values, the
code worked properly.
Thanks for the help.

Regards,
Rad.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu