I’m trying to make a virtual keyboard that springs up from the bottom of the screen, then collapses back off-screen when dismissed. In the IDE and on other platforms (macOS) there’s nothing tricky to it, but it’s giving me trouble on RPi/Linux.
I’m trying to create a new instance of a Window, which needs to instantiate at .Top = 480, and .Left = 0 (this puts it off-screen initially). However, the Window doesn’t accept the .Top or .Left settings unless it’s visible. I’ve tried setting .Top/.Left from within the Window’s Open Event, and if I read back the value it shows that it accepted the new .Top/.Left assignment, but the window hasn’t moved to the new coordinates.
The window is a type ‘Plain Box’, and I’m calling it’s .Show() method. If I do this and instantly follow up by setting the .Top value the window does move as expected - but this makes an ugly “flash” for a split second while the window is initially drawn on screen, before snapping to it’s correct coordinates.
Is there a trick to instantiating a new window, off-screen, without first having it drawn on-screen?
Make sure ImplicitInstance and Visible is Off for the window (see the Inspector panel for the window)
In the code fragment below the window is Window2.
In my test code this fragment is in a PushButton, but it could be almost anywhere.
Having said that, putting it in the windows Open event is probably not a good idea.
dim thisWindow as new Window2
thisWindow.Top = 480
thisWindow.Left = 0
Works for me (Windows 10 Pro 18362 x86_64, Xojo2019r1)
I’ve already written a small virtual keyboard for the Raspberry Pi.
Unfortunately I’m away from home right now, but if you ping me in about a week I might be able to dig something out for you.
Hi Robin - yeah, it sure seems like that’d work. I’ve tried every combination and it still displays the window where it would have naturally originated.
Once the screen appears then altering the .Top/.Left property works great. So far I’ve had to resort to setting the properties in the Activate event, which means the screen briefly appears (only for a split second) and then moves to the correct location (off screen).
I’m testing all this in a simple app, before merging it with my main project, just to ensure it behaves well on it’s own, so there’s nothing else in the project that I believe is contributing to the issue.
Additionally, no matter what I set .Top to, it will never fully move off the bottom of the screen - it seems to have a lower limit that it won’t go beyond, and it renders about 20 px from the bottom of the screen.
I meant to say that I appreciate your response by the way!
And one oddity that I should have mentioned is that I’m running a vertical orientation 272 W x 480 H. No idea if this is any possible cause.
I may simply resort to using Containers or some other control within the calling window, to get around this altogether.
Just to close the loop on this one - I solved it by tossing out the idea of using a Window as the container for the foundation of a virtual keyboard and went with a Container and embedding canvas controls in it. Whatever the glitch with Raspian/Xojo is in this case I may never know - but for now the Container solution works 100% as well as I needed.
Of you set the window.bounds and assign it a new instance of realbasic.rect does that work for you?