Jump to content

Recommended Posts

Posted
17 minutes ago, Freeman35 said:

What is the difference between BroadcastMessage and BroadcastMessageSessions?

Hello,

  • BroadcastMessage → sends to all sessions
  • BroadcastMessageSessions → sends to selected sessions
Posted

Thank you,

10 minutes ago, Sherzod said:

Hello,

  • BroadcastMessage → sends to all sessions
  • BroadcastMessageSessions → sends to selected sessions

How to use OnBroadcastMessage event on TUniFrame ?

I think only Farshad knows this.

Posted
32 minutes ago, Freeman35 said:

How to use OnBroadcastMessage event on TUniFrame ?

TUniFrame does not support OnBroadcastMessage because this event belongs to TUniBaseForm.

A TUniFrame is a visual container and cannot exist independently; it must be hosted inside a form or another container.

Broadcast messages are handled at the session/form level, so they are delivered to forms.
If needed, the form can forward the message to its frames...

Posted

  TUniFrame = class(TCustomFrame, IUniControlOrdered, IUniControl, IUniControlEx, IUniCoreNotify, IUniLayout, IUniDialogs)
  private
    FOwnerWebForm : TUniBaseJSForm; <--

-----------------------------------------------------

  TUniBaseForm = class(TUniBaseIntermForm, IUniForm, IUniLayout, IUniControlEx)
  private
mentControl;
    FWebForm : TUniBaseJSForm; <--

-----------------------------------------------------

procedure TUniBaseJSForm.DoSocketMessage(const Params: TUniStrings);

....

If work on this, I thing TUniFrame can get FOnBroadcastMessages

 RASCore use many TUniFrame etc.

Posted
7 hours ago, Fred Montier said:

Is more simple: uses the PARAM property in the msg broadcasting and you can target and/or tailor whatever you want.

Yes you rigth. Have to handle message in form. Okay Its can be Main form. But I have to write code for this. check target, it iss created? showed? will sent this to that frame? etc. sent message(s) to them etc.

if if TFrame has "OnBroadcastMessages" event just write code in this event. If need.

I'm just asking why not TFrame as well, just to simplify the code. If I'm not mistaken, everyone uses TFrame for its lightness. The goal is less code, less overhead.

Posted

I use PubSub pattern. New frames are registered in a list in the main window. When a broadcast message is received it is forwarded to a registered frame/frames.

  • Administrators
Posted
17 hours ago, Freeman35 said:

Thank you,

How to use OnBroadcastMessage event on TUniFrame ?

I think only Farshad knows this.

Not exactly, because frames are just like any other controls in the app. Each form may contain many frames and uniGUI doesn't maintain a list of active frames internally. 

Posted

Result: There will be no OnBroadcastMessage in TFrame. Am I understanding correctly?
(I use Google Translate, translations can sometimes be incomprehensible.)

  • Administrators
Posted

No. There's no plan to add it because of implementation complexity and other difficulties. 

OnBroadcastMessage will be supported on main form and other active forms. Maybe you can share your usage scenario and we can make recommendation based on it.

 

Posted
57 minutes ago, Freeman35 said:

Result: There will be no OnBroadcastMessage in TFrame.

You can handle the broadcast in the form and forward it to the frame:

procedure TMainForm.UniFormBroadcastMessage(
  Sender: TComponent; const Msg: string; const Args: array of const);
begin
  if Msg = 'update' then
    MyFrame.RefreshData;
end;

Since TUniFrame does not support OnBroadcastMessage, the form should act as a proxy.

Posted
23 minutes ago, Farshad Mohajeri said:

No. There's no plan to add it because of implementation complexity and other difficulties. 

OnBroadcastMessage will be supported on main form and other active forms. Maybe you can share your usage scenario and we can make recommendation based on it.

 

Hello, 

The reason for my insistence is that I use RADCore, and it only uses frames. Even if I find this from the children of the form, it may not work correctly in this respect because it plays with the parents of the frames. I want this to use instead of Firebird Event alerter. I used fbEventAlerter in 2020, there was no OnBroadcastMessage at that time. There is no need to use the same method, the message over the db, moreover, a single value is meaningless now.

I will do my work such as chatting etc. between frames (between different sessions). 

TUniGUISession.FormsList and TUniGUISession.DataModules are available, if you can add TUniGUISession.FrameList to this, I will have done my job. I will prevent any confusion that may arise from the parent.

If you say it won't happen, I will have to put a tlist in the mainmodule and create my own list by tuniframe's oncreate and ondestroy.

 

18 minutes ago, Sherzod said:

You can handle the broadcast in the form and forward it to the frame:

procedure TMainForm.UniFormBroadcastMessage(
  Sender: TComponent; const Msg: string; const Args: array of const);
begin
  if Msg = 'update' then
    MyFrame.RefreshData;
end;

Since TUniFrame does not support OnBroadcastMessage, the form should act as a proxy.

The problem is not being able to create a correct list for TuniframeChecking the children of the form is not the right approach, because if the parents are changed, this system will not work correctly.

Posted
On 4/30/2026 at 4:27 AM, Freeman35 said:

Yes you rigth. Have to handle message in form. Okay Its can be Main form. But I have to write code for this. check target, it iss created? showed? will sent this to that frame? etc. sent message(s) to them etc.

if if TFrame has "OnBroadcastMessages" event just write code in this event. If need.

I'm just asking why not TFrame as well, just to simplify the code. If I'm not mistaken, everyone uses TFrame for its lightness. The goal is less code, less overhead.

See uniFrame as a "glorified" panel.  

Keep a Frame string ID list at parent form level. When parent form  receives that messages targeting the particular hosted frame,get the ID  and trigger your code towards  that frame. Using this, you can target anything in a form as a pseudo onAjaxEvent.

Same login to a form handling a chat with many user, and direct messaging to one of them.

Keep in mind that RadCore is a solution looking for a problem. I think radcore support team should give you a better solution, if any.

If you scale your app, will also scale this problem. Just imagine using this approach with hyperserver. This solution ALSO will not work. Better ask them. 

See the chat demo and how to handle broadcasting with uniStrings

Posted

Thank you Fred,
I solved the problem for myself. Farshad "We will try to find a solution for this." When I wrote it, I ended it so as not to extend the topic.
Simple logic, MainForm must be in every project. This means one mainform in each session. TUniFrame.OnCreate adds itself to the list above, and .OnDestroy deletes it. This gives me the Frames list. With TMainForm.UniFormBroadcastMessage, I can send incoming messages to any open uniframe etc. in the osession, wherever I want.

regards.

  private 
    { Private declarations }// It should only belong to this session
    F_Frame_List: TList<TUniFrame>;// My Frame list

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...