Hi All,
I have a form that has 6 panels on it. The top 2 are static and will not move. There are 4 below it that will be dynamic and only 1 at a time wil be "visible". Based on a keypress event, I'd like to have whichever panel "slide" into view rather than just appearing which is what it is doing right now and looks very boring. So my question is how to "slide" a panel up or even down on a form? I have been searching the forum and I think I have narrowed it down to putting these panels in a DrawingArea component...am I close?? Can anyone point me to a thread or the software farm that might have what I'm looking for?
Sliding effects
Re: Sliding effects
Just an FYI, I am currently playing around with a scrollview trying to achieve this by scrolling up and down using scrollX and scrollY. This might work...I'll report back later.
Re: Sliding effects
if I was to do this I would place the panel and use the top and left objects of the panel and increment them to your liking. You may have to do a wait for a time delay so it doesn't go too fast. adjust it to your taste.
for example
if you have a panel called. panel1
for example
if you have a panel called. panel1
Code: Select all
dim X as integer = 1
dim Y as integer = 1
for X = 1 to {final location of panel}
panel1.Left = x
Panel1.Top = Y ' this is something you can also increment if you want diagonal slide you do not have to set top each time if it stays the same. This line is optional
wait 100 ' this provides a short delay so the panel can be seen moving and allows for redrawing
next
- BruceSteers
- Posts: 2070
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Sliding effects
Check out SidePanel and Expander containers
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- cogier
- Site Admin
- Posts: 1202
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Sliding effects
Have a look at the attached program. Let me know if I am on the right track.
Re: Sliding effects
Thanks guys! Cogier, that is the direction I am looking to go. I like how it's not very much code. I will study this and see if I can work in 4 or more panels with this. The goal is to have 4 or 5 panels (not sure how many right now) and a keypress event will move the "current" panel out of view and then slide the next one into. Thanks cogier!
- cogier
- Site Admin
- Posts: 1202
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Sliding effects
Here is a different way to animate the panels. This example has the 5 panels you want.
Re: Sliding effects
Thanks Cogier! I've never done any fancy eye candy in my apps before so I never bothered to play around with X and Y. I've got a form i'm working on and just for now it's a couple of picture boxes that slide up and down in unison and it looks like it's what I'm trying to accomplish here.
Re: Sliding effects
I do actually have another question related to all the questions I've been asking the last few weeks including this one. I'm working on a personal project and all the user input to the app will be coming from a linux friendly remote control I found on amazon. Very similar to amazon's RC for their firestick type products. This particular thing, the moving of the panels, doesn't work very well when I put it in a keypress event. I get "gb.gtk3: warning: calling the event loop during a keyboard event handler is ignored" then the panel just disappears. If I put the code in a button and click it, it works perfectly, I can see it "slide" up and then out of view. Here's the code for the form I mentioned earlier:
I even tried to button_click inside the keypress event and that didn't work either. Why does this code work for a button click but not when using arrow up/down keys?
dypan1.Y = dypan1.Y - 1
Wait 0.1
dypan1.Y = dypan1.Y - 2
Wait 0.1
dypan1.Y = dypan1.Y - 3
Wait 0.1
dypan1.Y = dypan1.Y - 4
Wait 0.1
dypan1.Y = dypan1.Y - 5
Wait 0.1
dypan1.Y = dypan1.Y - 6
Wait 0.1
dypan1.Y = dypan1.Y - 7
Wait 0.1
dypan1.Y = dypan1.Y - 8
Wait 0.1
dypan1.Y = dypan1.Y - 9
Wait 0.1
dypan1.Y = dypan1.Y - 10
Wait 0.1
dypan1.Y = dypan1.Y - 11
Wait 0.1
dypan1.Y = dypan1.Y - 12
Wait 0.1
dypan1.Y = dypan1.Y - 13
Wait 0.1
dypan1.Y = dypan1.Y - 14
Wait 0.1
dypan1.Y = dypan1.Y - 15
Wait 0.1
I even tried to button_click inside the keypress event and that didn't work either. Why does this code work for a button click but not when using arrow up/down keys?