B4J Question Sliding sub form

atiaust

Active Member
Licensed User
Longtime User
Hi All,

Does anyone know how to get a form to slide into view from under another form?

I have a main form and I want to use a button click to slide a narrower form out from under the main form then the button click to hide it again.

I have looked at "Use Timelines to 'slide' listviews" by Daestrum but I want the main form to stay in place.

Any ideas?

Thanks
 

stevel05

Expert
Licensed User
Longtime User
Try this:

Requires B4j v5.00 for the Always on top function
 

Attachments

  • SlideForm.zip
    1.3 KB · Views: 272
Upvote 0

atiaust

Active Member
Licensed User
Longtime User
Thanks stevel05,

That's what I was looking for. Will just need to adapt to my existing form layouts. I am using B4J v5.00..
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
No Problem, here's a version as a Class, although you would want a separate class for each instance to avoid the code becoming cluttered, but it keeps the code out of the main module.
 

Attachments

  • SlideForm1.zip
    2.9 KB · Views: 262
Upvote 0

atiaust

Active Member
Licensed User
Longtime User
Thanks stevel05,

One question, if you drag the sub form (slide) away from its original position you can't close it until you move it back to its original position or you keep clicking on the close or hide button until it closes. Do you know what causes this?

Thanks again.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Yes, the calculation in SlideTimer_Tick assumes that it will be in the same place, how you get around that depends on what you want it to do. If it's been moved then you may want it to close straight away without sliding, in which case you can test the window position and just close it in the Hide sub.

Or you may want to prevent it being moved from it's extended position altogether, in which case you could change the window decoration so it can't be dragged, or add change listeners to the slide panel's x and y properties and set it so it doesn't move.
 
Upvote 0

atiaust

Active Member
Licensed User
Longtime User
Thanks

I figured that it was to do with positioning. I was just about to try the window decoration.
 
Upvote 0
Top