Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Browser dimensions OnAsyncResize (Priority support)
#1
I am using Intraweb 15.2.69 with Rad Studio 10.2.3 (C++ Builder)
I am a paid user so I suppose I have access to priority support.
I need to have the right dimensions on the user's browser using the AsyncResize event.
If I try to write the positions of elements using those information they are totally wrongly positioned.
So I wrote the simple code below to see the dimensions returned.

void __fastcall TIWForm1::IWAppFormAsyncResize(TObject *Sender, TStringList *EventParams)
{
        WebApplication->ShowAlert("Height : " + IntToStr(WebApplication->FormHeight));
        WebApplication->ShowAlert("Height : " + IntToStr(WebApplication->FormHeight));

}

I realized that unfortunately the dimensions are not right.
But if I write a JavaScript code using window.addEventListener("resize", ), I get the right dimensions! The problem is that I need to use executeAjaxEvent() to get it on the server side and that slows the rendering of my application.
I had the same problem with Intraweb 14. I upgraded to Intraweb 15 hoping that the issue is resolved. But apparently not!
Reply
#2
I did additional tests and the dimensions displayed are right! Only the height is a little lower. I think it is simply because it the browser innerHeight.
I think the components are not displayed properly because the way the AsyncResize is triggered!
Normally onResize means that the windows is completely resized. But I think in this case its dimensions are not fully completed this is why the components get the wrong dimensions.
The solution may be to determine is the resize is fully completed before to set the positions of the components. For that it will be useful to know the parameters returned by *EventParams?
Does somebody know?
Reply
#3
I listed the parameters returned by *EventParams (see attached screenshot)
But I do not see any parameter which can help to determine when the resize process is completed!


Attached Files Thumbnail(s)
   
Reply
#4
OK. This is the kind of situation I do not appreciate at all!
This is a basic feature which is not working since Intraweb 14!
WHERE IS THE PRIORITY SUPPORT!!
Reply
#5
Hi Valmeras,

This is what I did:

1) I created a new blank application, from scratch using the IntraWeb application wizard

2) On the Form's OnAsyncResize event I just added a comment (to avoid that the IDE removes it when I save the project). Then I put a breakpoint on the start of the method.

3) Saved, built and ran the project.

When I start a new session, a page opens and the execution stops in my breakpoint. Here's what I get, inspecting the fields received in the event:

   

WebApplication.FormWidth is set accordingly:

   

WebApplication.FormHeight too:

   

Then I opened the browser console and checked the sizes of the window, using 2 different isolated libraries, IW own JavaScript library and also jQuery which is pretty much standard:

   

As you can see, all numbers match. Everything looks correct to me.

If you are getting something different than this, I suggest that you create a simple test case showing the problem and attach it to your post.

Cheers,
Reply
#6
It corresponds to what I was saying. If you display the dimensions they will be right
The problem occurs on mobile devices when you try to define positions of components. Personally I use onAsyncResize only on mobile devices to see if the user has turned his device portrait or landscape.
I have attached a simple test. It should work fine on a desktop.
But I tested it both on Android (Chrome browser) and Safari (IPhone) and the components positions are not right certainly due to the fact the onResize events rendering is delayed!


Attached Files
.zip   Test.zip (Size: 57.93 KB / Downloads: 0)
Reply
#7
What you need is a different event, the "orientationchange" event that is triggered when a mobile device is rotated (and the screen switches from portrait to landscape, or vice-versa).

I'll make this event available in IWForm so you can use it as soon as we release an update.
Reply
#8
OK. I will wait for the next update.
Is it possible to know approximately when this update will be available?
Because I noticed that most of users use the mobile version. This is the one I need to update first!
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)