Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 5 of 5 total |
User Defined Notifications |
Thu, Jun 28 2018 2:58 PM | Permanent Link |
Mark Brooks Slikware | Question for Tim or anybody else who's already done this.
I "think" that the EWB framework provides a mechanism to send a user-defined notification to all instances of a specific TControl descendant? I want to let all TBasicPanel descendants in my app know about something. Does anybody have sample code to achieve this? Also, can any form of scope be applied? Thanks in advance Mark |
Fri, Jun 29 2018 4:03 AM | Permanent Link |
Matthew Jones | Mark Brooks wrote:
> mechanism to send a user-defined notification to all instances of a specific TControl descendant? Not that I'm aware of. There is a way to use any single instance as a transmission post for a message. That will work well for some people, but when I did this I used a more generic message system that anything can register with and receive notifications by an ID. Search the newsgroup for TNotificationEvent for the source. Not sure it will do what you are wanting, unless you have your components all register automatically. -- Matthew Jones |
Fri, Jun 29 2018 7:43 AM | Permanent Link |
Mark Brooks Slikware | Ah yes ....... now I remember (age is a terrible thing)
|
Fri, Jun 29 2018 1:28 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Mark,
<< I "think" that the EWB framework provides a mechanism to send a user-defined notification to all instances of a specific TControl descendant? I want to let all TBasicPanel descendants in my app know about something. Does any body have sample code to achieve this? Also, can any form of scope be applied? >> It's functionality that is in the TComponent class, and yes, it will allow for this: Register with a component for notifications: https://www.elevatesoft.com/manual?action=viewmethod&id=ewb2&comp=TComponent&method=Register Un-register: https://www.elevatesoft.com/manual?action=viewmethod&id=ewb2&comp=TComponent&method=UnRegister The other important methods are protected and one needs to be overridden in order to implement your functionality: Sending notification: procedure TComponent.Notify(ID: Integer; Data: TObject=nil); Receiving notification (need to override): function TComponent.Notification(Sender: TComponent; ID: Integer; Data: TObject): Boolean; Both are in the WebCore unit. You'll also notice that the Notification method returns a result. When true, the result serves to tell the notification broadcasting (Notify) to stop notifying other components after this point, which is useful when you have a multiple notification types, but one or more of the notification types are only actually targeted at one particular listener and you want to stop notifying once that listener receives the notification. When defining notifications, make sure that you use cmUser constant (defined in the WebCore unit) as the base value, and you'll be all set and won't interfere with any internal EWB notifications. Tim Young Elevate Software www.elevatesoft.com |
Mon, Jul 2 2018 3:18 AM | Permanent Link |
Mark Brooks Slikware | All good thanks - appreciate the recap
|
This web page was last updated on Wednesday, April 17, 2024 at 10:35 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |