Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A good way to get a form to slide open to another part of the form 4

Status
Not open for further replies.

Davefeet

Technical User
Jan 24, 2002
212
US
Can anyone reccomend...

I want my form, when I press a button, to show another part of the form. Kinda like a menu but the menu contains buttons and other controls...
I actually want to SEE it slide open also when it does this.

I was thinking that there would be a good activex control for this?

Thanks

SLC: Greatest snow on earth!!!
 
look at the insidewidth it controls the width of the window. In the quick test I ranI had a button on the far right and one far left of the form. This hides the right button till I pushed the left button

Private Sub Form_Load()
Me.InsideWidth = Me.Width / 2
End Sub

Private Sub Command1_Click()
Me.InsideWidth = Me.Width
End Sub

 
That was the way I was thinking about doing it, with a form resize code. But I was wondering if there was a fancy way to make it slide out, kinda a cool effect.

SLC: Greatest snow on earth!!!
 
If I understand what you're trying to do, you don't need an ActiveX control, you can do this straight from VBA.

On your form add two Command Buttons (cmdShrinkForm and cmdExpandForm), then drop in the following event handlers:
Code:
Private Sub cmdExpandForm_Click()

   Dim Idx As Integer
   
   For Idx = 1 To 200
     DoCmd.MoveSize , , (Me.WindowWidth + 15), (Me.WindowHeight + 15)
   Next Idx

End Sub

Private Sub cmdShrinkForm_Click()

   Dim Idx As Integer
   
   For Idx = 1 To 200
     DoCmd.MoveSize , , (Me.WindowWidth - 15), (Me.WindowHeight - 15)
   Next Idx
   
End Sub
The reason that I'm adding/subtracting 15 from the current width and height is that movesize works in twips and there are 15 twips per pixel. Give yourself sufficient size to work with because you'll get into trouble if you shrink or expand too much. You can adjust the +- 15 and the iteration count for the desired speed effect. You don't have to adjust both the width and height if you don't want to.


Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Wonderfull

How did you figure that out?

works exactley the way I want

SLC: Greatest snow on earth!!!
 
Very nice piece of work here CajunCenturian. Have another Star on me. I also made reference to this posting in another thread that you participated in a while back where cloud wanted to expand his form upon demand at runtime. Nice code.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Davefeet said:
How did you figure that out?
The answer is not very exciting. It's in the manual, I read about it, and tried it out.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
The old Movesize. You can also play with the Right and Down. Don't forget that the movesize doesn't work if the form is max. or min. so make sure your form is in Restore mode. (restore method)
 
It's in the manual, I read about it, and tried it out.

That's an amazing idea. One of these days, I'll have to try that. ;-)

Thanks for the code CajunCenturion. Sometimes, simply knowing where in the manual to look can help. I had never heard of the movesize command until I was told that you had posted some code with it. I plan to use something similar to build my own msgbox replacement form. (I hate how msgbox blocks all code running in the background.)

Another star to you.
 
Great Post CajunCenturian,

I'll be doing the same thing as KornGeek, modifying my custom msgbox form(s). I have 3 that I use continually.
I can now replace them all with 1 and use the OpenArg Method. Another STAR for you.

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top