Atozed Forums
start the application with a differente presentation depending on the device model - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: start the application with a differente presentation depending on the device model (/thread-2257.html)



start the application with a differente presentation depending on the device model - bhainak - 01-19-2021

Hello how to make the application have a different presentation depending on whether it is launched on a smarphone or an I-phone and on a PC.

In one case it would be in portrait mode and in the other, in landscape mode.

I think you need to run a JavaScript at startup, but how to get the result of the javascript function to tell Intraweb to use a portrait or landscape template.

thank's


RE: start the application with a differente presentation depending on the device model - kudzu - 01-19-2021

You can look at the resolution of the device or the browser string and adjust as necessary. You can then change which template is uses, which page is used, adjust the layout, or even use JS in the template to make these changes.

Or more easily use a responsive layout using a template. An easy way to do this is to use Bootstrap templates which IntraWeb also supports.


RE: start the application with a differente presentation depending on the device model - Alexandre Machado - 01-21-2021

You can use ServerController.OnGetMainForm event.

This event triggers just before rendering the first form for that session. The session has already been created and you have all information for it:

Code:
procedure TIWServerController.IWServerControllerBaseGetMainForm(var vMainForm: TIWBaseForm);
var
  WebApp: TIWApplication;
  w, h: Integer;
  isMobile: Boolean;
begin
  WebApp := gGetWebApplicationThreadVar;
  if Assigned(WebApp) then
  begin
    w := WebApp.FormWidth;
    h := WebApp.FormHeight;
    isMobile := WebApp.Browser.IsMobile;
  end;
end;

Then, based on this information you can set vMainForm variable to the specific form to handle that client.


RE: start the application with a differente presentation depending on the device model - bhainak - 01-27-2021

hello it is ok , thank you very much