Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OnChange inaccessible error ?
Hi All,

I have an OnChange event for a IWEdit1 field. As expected it fires every time the Text is changed, including when I in code assign a text to IwEdit1.text (like IwEdit1.text := 'ggg'). I some cases I do not want it to fire and I would normally set the event pointer in code, before and after the assignment to avoid it firing:

IWEdit1.OnChange := nil;
IWEdit1.text := 'Some initial text';
IWEdit1.OnChange := IWEdit1Change;

Can I do something similar in IntraWeb ?

For the the above example IWEdit1.OnChange := nil; the IDE accepts the code but the compiler fails with error E2233:" 'OnChange' inaccessible here.

Anybody knows why ?

The way I handled this was to have a separate proc for the code change and call it on the on change event. I haven't been able to assign the events like I do in Delphi.

If x=1 then
{call change event}
{do nothing}

Hope this helps.
I dont see OnChange as an event of IWEdit. It would create a TON of full callbacks anyway. There is an OnAsyncChange though.

Sorry, bad example. Of course IWEdit1 do not have an OnChange event.

The question was a general one about events. Not just OnChange or OnAsyncChange. The issue is whether it is possible to disable and enable events in code.

As for the error mentioned: It is correct that IDE will accept the code, but the compiler will reject it. I suspect it should be so as IWEdit is a descendant from TEdit which has an OnChange event.

The IDE uses an outdated parser and is very frequently inaccurate. Someone told me its barely been updated if at all since D2007 and still uses .NET. Its slated to be rebuilt but I dont know when EMBT will do it.

Its not updated for the new language features either for 10.3 and other and it regularly flags code that is valid but it doesnt know about.

The compiler is the one to trust here.

TIWEdit does not descend from TEdit. Doing so would bring in a lot of baggage including Windows handles which dont work well in threads etc... Some of our competitors do this or similar and it creates harsh scalability and stability limitations for them.
Hi Kudzu,

Thanks for clarifying this. I have noticed the problems with the IDE. Mostly the other way round though. Where IDE flags as error but where compiler accepts.

The essence of my question still stands: Is it possible to turn events on and off in code, using notations like in my (faulty) example above ?


Forum Jump:

Users browsing this thread: 1 Guest(s)