Presence
TsgcHTMLComponent_Presence — a "who is online" roster, rendered as an overlapping avatar stack or a list, with status dots and live WebSocket updates, in Delphi, C++ Builder and .NET.
TsgcHTMLComponent_Presence — a "who is online" roster, rendered as an overlapping avatar stack or a list, with status dots and live WebSocket updates, in Delphi, C++ Builder and .NET.
Add users with AddUser, cap how many show with MaxVisible, then read the HTML property — or push a status change to open clients with GetUserFragmentHTML.
TsgcHTMLComponent_Presence
Avatar stack or list, plus scoped CSS
Delphi, C++ Builder, .NET
Call AddUser for each person, read HTML for the initial render, then call SetUserStatus and push GetUserFragmentHTML when someone's status changes.
uses
sgcHTML_Component_Presence;
var
oPresence: TsgcHTMLComponent_Presence;
begin
oPresence := TsgcHTMLComponent_Presence.Create(nil);
try
oPresence.PresenceID := 'roster';
oPresence.Layout := plAvatars;
oPresence.MaxVisible := 5;
oPresence.Title := 'Online';
oPresence.AddUser('u1', 'Ana Torres', psOnline);
oPresence.AddUser('u2', 'Marc Bell', psAway, '', 'Back at 3pm');
oPresence.AddUser('u3', 'Kenji Ito', psBusy);
WebModule.Response := oPresence.HTML; // avatar stack + scoped CSS
finally
oPresence.Free;
end;
end;
// Push a status change to every connected client, no full re-render:
oPresence.SetUserStatus('u2', psOnline);
TsgcHTMX_Engine_Server.BroadcastFragment(oPresence.GetUserFragmentHTML('u2'));
// includes: sgcHTML_Component_Presence.hpp
TsgcHTMLComponent_Presence *oPresence = new TsgcHTMLComponent_Presence(NULL);
try
{
oPresence->PresenceID = "roster";
oPresence->Layout = plAvatars;
oPresence->MaxVisible = 5;
oPresence->Title = "Online";
oPresence->AddUser("u1", "Ana Torres", psOnline);
oPresence->AddUser("u2", "Marc Bell", psAway, "", "Back at 3pm");
oPresence->AddUser("u3", "Kenji Ito", psBusy);
String html = oPresence->HTML; // avatar stack + scoped CSS
// Push a status change to every connected client:
oPresence->SetUserStatus("u2", psOnline);
TsgcHTMX_Engine_Server::BroadcastFragment(oPresence->GetUserFragmentHTML("u2"));
}
__finally
{
delete oPresence;
}
using esegece.sgcWebSockets;
var presence = new TsgcHTMLComponent_Presence();
presence.PresenceID = "roster";
presence.Layout = TsgcHTMLPresenceLayout.plAvatars;
presence.MaxVisible = 5;
presence.Title = "Online";
presence.AddUser("u1", "Ana Torres", TsgcHTMLPresenceStatus.psOnline);
presence.AddUser("u2", "Marc Bell", TsgcHTMLPresenceStatus.psAway, "", "Back at 3pm");
presence.AddUser("u3", "Kenji Ito", TsgcHTMLPresenceStatus.psBusy);
string html = presence.HTML; // avatar stack + scoped CSS
// Push a status change to every connected client, no full re-render:
presence.SetUserStatus("u2", TsgcHTMLPresenceStatus.psOnline);
TsgcHTMX_Engine_Server.BroadcastFragment(presence.GetUserFragmentHTML("u2"));
The members you reach for most often.
AddUser(aId, aDisplayName, aStatus, aAvatarURL, aStatusText) upserts a roster entry: an existing Id is updated in place.
TsgcHTMLPresenceStatus — psOnline, psAway, psBusy, psOffline. SetUserStatus(aId, aStatus, aStatusText) updates just the status dot and text.
Layout picks plAvatars (overlapping avatar stack) or plList (name + status rows); AvatarSize sets the avatar diameter in pixels.
MaxVisible (default 5) caps how many users are shown before a "+N" chip appears; every user stays in the markup so a later push still finds it.
Title and ShowCount render a header with an online-count badge; GetOnlineCount excludes psOffline users.
GetUserFragmentHTML(aId) (also emits a delete once RemoveUser is called), GetCountFragmentHTML and GetMoreFragmentHTML feed TsgcHTMX_Engine_Server.PushFragment / BroadcastFragment.
| Online HelpFull API reference and usage guide for this component. | Open | |
| All sgcHTML ComponentsBrowse the full feature matrix of 80+ components. | Open | |
| Download Free TrialThe 30-day trial ships the 60.HTML demo projects. | Open | |
| PricingSingle, Team and Site licenses with full source code. | Open |