05-22-2021, 11:04 PM
(05-21-2021, 05:55 AM)Сергей Александрович Wrote: Something is not working... Always defines as stationary. Look, I probably wrote something wrong...
ServerController:
public
{ Public declarations }
mMobile : Boolean;
end;
...
procedure TIWServerController.IWServerControllerBaseBrowserCheck(
aSession: TIWApplication; var rBrowser: TBrowser);
begin
if rBrowser.IsMobile
then mMobile := true
else mMobile := false;
end;
procedure TfmVmMain.IWAppFormShow(Sender: TObject);
var
begin
if TIWServerController(WebApplication).mMobile then
begin
lblbUser.Caption := 'Mobile';
end else begin
lblbUser.Caption := 'Stationary';
end;
end;
Always defines as Stationary
This procedure shows different forms according to the connected device, it could serve you
Code:
procedure TIWServerController.IWServerControllerBaseGetMainForm(
var vMainForm: TIWBaseForm);
var
IWApplication: TIWApplication;
W,H: Integer;
Mobile: Boolean;
begin
IWApplication := gGetWebApplicationThreadVar;
if Assigned(IWApplication) then
begin
W := IWApplication.FormWidth;
H := IWApplication.FormHeight;
Mobile := IWApplication.Browser.IsMobile;
if Mobile = False then
vMainForm := TIWFormLOGIN.Create(WebApplication) //PC-Laptop
else
vMainForm := TIWFormMLOGIN.Create(WebApplication);//Mobile
end;
end;
