Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
start the application with a differente presentation depending on the device model
#1
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
Reply
#2
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.
Reply
#3
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.
Reply
#4
hello it is ok , thank you very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)