|
<< Click to Display Table of Contents >> Navigation: Telegram > 2022 > 09 > 22 > Telegram_2022-09-22T12 |
2022-09-22T12:23:06
Here is what i used using IWjQGrid to show in a grid.
i did it a long time ago and never looked back, so i think there is a better and cleaner way to do it.
sorry, i don't remember who to credit most of this code (probably Alexandre)
=================
Private
MyCells : Array Of Array Of String;
procedure TfrmWhoIsOnline.IWjQGrid1GetCellText(Sender: TObject; const Row, Col: Integer; var CellText: string);
begin
inherited;
If Assigned(MyCells) Then
CellText := MyCells[Col, Row];
end;
Procedure TfrmWhoIsOnline.GetSessionList;
Var I, X : Integer;
ThisUserSession : TIWUserSession;
LSessionList : TStringList;
Begin
// First, create a session list to hold the session IDs
LSessionList := TStringList.Create;
Try
LSessionList.Clear;
gSessions.GetList(LSessionList);
X := LSessionList.Count;
SetLength(MyCells, 11, X);//Setting the Dynamic Array
IWjQGrid1.RowCount:=X;
IWLabel1.Caption := 'Total records : ' + IntToStr(X);
For I:=0 To X-1 Do Begin
gSessions.Execute(LSessionList[i],
Procedure(aSession: TObject)
Var LSession: TIWApplication absolute aSession;
Begin
ThisUserSession := LSession.Data as TIWUserSession;// The \Internals\ of that same Session
If LSession.Browser.IsMobile Then
MyCells[0, I]:='Mobile'
Else
MyCells[0, I]:='Computer';
MyCells[1, I] := ThisUserSession.MyEsek.EActivityName;
MyCells[2, I] := IntToStr(ThisUserSession.MyEsek.EID);
MyCells[3, I] := ThisUserSession.MyEsek.EName;
MyCells[4, I] := LSession.IP;
// MyCells[5, I] := LSession.ActiveForm.Name + ' - ' + 'FormsCount='+LSession.ActiveFormCount.ToString;
MyCells[5, I] := LSession.ActiveForm.Name;
MyCells[6, I] := ThisUserSession.UserProfileName;
MyCells[7, I] := IntToStr(ThisUserSession.UID);
MyCells[8, I] := ThisUserSession.UserName;
MyCells[9, I] := ThisUserSession.UserFullName;
MyCells[10, I] := DateTimeToStr(LSession.SessionTimeStamp);
End
);
End;
Finally
LSessionList.Free;
End;
2022-09-22T12:46:23
yeah. looks like \gSessions(list)\ is the newer method of doing things. Most of the docs I was reading were very old, before that specific feature. I think i am stuck using the same method