Sliding effects
Posted
#1
(In Topic #1435)
Regular

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?
Posted
Regular

Posted
Enthusiast

for example
if you have a panel called. panel1
Code
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
Posted
Guru

Posted
Guru

Posted
Regular

Posted
Regular

cogier said
Have a look at the attached program. Let me know if I am on the right track.
PanelSlide-0.0.1.tar.gz
Ah! PanelExpand size is just shrinking… Very clever! Seems like I'm going to have to do some math to work in more panels
Posted
Guru

Posted
Regular

cogier said
Here is a different way to animate the panels. This example has the 5 panels you want.
PanelSlide-0.0.2.tar.gz
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.
Posted
Regular

Code (gambas)
- 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?
Posted
Regular

1 guest and 0 members have just viewed this.


