WebDialog - not resizing after Save and load position/size

I have implemented a webdialog where the user can save (dismiss event) and load (shown event) the position and its size in cookies.
But when successfully save/load then resizing the webdialog class/instance does not work.
Is anybody who can confirm or has a fixing in that?

I believe that the shown event is late. Instead, i would suggest to try reading the cookie and resizing the dialog in the code that calls it. For example, I have this code in a method (this webdialog lets me select specific partners in a specific context for processing):

[code]
Dim wdListePartenaires As New wdFindSalesPartnersBase
AddHandler wdListePartenaires.Dismissed, AddressOf wdListePartenaires_Dismissed

'set position right on top of the command button.
'wdListePartenaires.Top = Me.cmdSearch.Top ’ no longer useful
'wdListePartenaires.Left = Me.cmdSearch.Left ’ no longer useful

// this is where I would place the code to size the dialog //

wdListePartenaires.PartnerType = “SOLDTO”
wdListePartenaires.Show [/code]

Thanks Luis. I will try it. However just to clarify things, the issue is that it reads the right position and size and put it correctly on the page but then when i try to resize the webdialog by catching the right-bottom edge, is not possible…

I use an instance of the class on the page to avoid addhadler etc
Unfortunately either by saving to a file or a cookie does not work.
test1 is the cookie version, quick code…

https://www.dropbox.com/preview/Public/test1.xojo_binary_project?role=personal

test2a is the file version
https://www.dropbox.com/preview/Public/test2a.xojo_binary_project?role=personal

I use Xojo 2019.1, seems like a xojo bug…? Appreciate If somebody can review them…

Problem still exist even creating webdialog on code and use AddHandler.
Is there anybody from Xojo stuff to inform me if this is an already known bug?

I could not find it back in feedback, but I bumped into a bug when creating RubberViewsWE.

Xojo reported the size of the grey modal mask instead of the size of the dialog itself.

I had to use JavaScript to get the actual size of the dialog.

Use the browser developer tools to look at the structure of the WebDialog. You got the grey mask, and the dialog itself.

I used the browser developers tools to find out. The problem is that I am unable to resize the dialog after loading and setting the “saved " width/height. Well, when this happened I got this code from browser in which at the end it miss the ;width:259px;height:345px;top:74px;left:328px;”> …

(this was the webdialog size before saving when all things worked as expected… When loading, the dialog is shown at the correct position but can’t resize it)

…part at the end of the code that follows from …:easy-out;">
Is there any instructions of how to tackle it?
Michel, is it possible to download the xojo projects above and compile and observe the behavior in your machine?

[code]

[/code]

Michael, it would be a whole lot easier if you posted a small sample project that demonstrates only the behavior, and posts the result though system.debuglog().

I could not even download all the files and folders you posted, DropBox went into error trying to zip all that paraphernalia.

Thank you.
That was my intention using dropbox… test1.xojobinary project is only 2.7 MB.
Please try this and if you got errors in downloading please let me know:
https://www.dropbox.com/sh/gbvqsulfyd7ycky/AABYsRzM5ekaR94ksQzTkInYa?dl=0

It includes a test1.mp4 little video
Never used in the past system.debuglog

I believe your issue is in the Initialize method, where you set the dialog size and position according to what you had stored in cookies.

If I comment out these two lines where you set the dialog width and height, I can move the dialog and set its size just fine.

'InstanceWebDialog.Width = VAL(Session.Cookies.Value("xx_W")) 'InstanceWebDialog.Height = VAL(Session.Cookies.Value("xx_H"))

You may have to settle with not setting the dialog size in code.

Thanks Michel, this is right but not being able to set width/size of the a palette type webdialog in code, seems to be a bug… any idea of how to tackle temporarily this issue? I have tried to set width/height of the webdialog in code in show/open event or even tried to assign them as values in properties before set the webdialog size with no lack!

Sometimes, you have to make due with what is available.

Instead of using width and height, here is what I did:

if l<>0 and t <> 0 then InstanceWebDialog.Left = VAL(Session.Cookies.Value("xx_L")) InstanceWebDialog.Top =VAL(Session.Cookies.Value("xx_T")) InstanceWebDialog.MinWidth = VAL(Session.Cookies.Value("xx_W")) InstanceWebDialog.MinHeight = VAL(Session.Cookies.Value("xx_H")) end if

And I added in Shown:

Sub Shown() Handles Shown me.MinWidth = 100 me.MinHeight = 100 End Sub

Now the palette can be resized freely. You have to figure out which minimum suits your app.

You could also resize the palette with JavaScript. The problem, though, would be that the Xojo framework would not be informed of the change, probably resulting in visual glitches. Reason why I did not test that.

That said, you should file a bug report in Feedback and attach your test1.xojo_binary_project. There is no reason that setting width in code becomes unmutable.

1 Like

It works by this way!!
I will file a bug report, Michel.

Appreciated your help, have a nice day!

When the dialog is created, the div code looks like this:

<div id="ehpCzo6R" class="palette" style="display: block; visibility: visible; z-index: 34; opacity: 1; animation-name: pop; animation-duration: 0.2s; animation-direction: normal; animation-iteration-count: 1; transition-property: none; transition-duration: 0.2s; transition-timing-function: ease-out; width: 490px; height: 434px; top: 35px; left: 439px;">

When you exit the application, run again and click Show, you get this:

<div id="SOu6RNqA" class="palette" style="display: block; visibility: visible; top: 35px; left: 439px; width: 490px; min-width: 490px; max-width: 490px; height: 434px; min-height: 434px; max-height: 434px; z-index: 14; opacity: 1; animation-name: pop; animation-duration: 0.2s; animation-direction: normal; animation-iteration-count: 1; transition-property: none; transition-duration: 0.2s; transition-timing-function: ease-out;">

For some reason, Xojo is adding min-width, max-width, min-height and max-height with the same values as width and height, that’s why is not possible to resize the dialog anymore.

This is not surprising. Xojo does that throughout for all webcontrols. For some reason it is not managed in case of resizing.

A possible workaround would then be to remove min-width and max-width with JavaScript, after setting width, and the same for height.