Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / September 2004



Tip: Looking for answers? Try searching our database.

Please help me with formula for scrollbar values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Atreju - 28 Sep 2004 04:12 GMT
I am creating a sort of menu bar.
What I have is an MDI window as my main application window.
I have a picturebox control aligned left.
Inside that is another picturebox control. This one, let's call it
picButtons, will contain any number of command buttons lined up
vertically with a bit of space between them. I am figuratively
emulating what you may have seen in MS Outlook - the "Outlook Bar."

I have seen some code online but it is very confusing. This is what I
now need:

At any time there may be any number of buttons in that picturebox. I
want to dynamically configure a vertical scrollbar at runtime so that
I may accomplish this:

When the user clicks the arrows, the inside picturebox will scroll up
or down in order to reveal more buttons. However, I want the min value
of the scrollbar, which will be reflected by the scrollbar being
scrolled "all the way up," to make the top of the inside picturebox
set at, let's say +120 twips in the container picturebox.
I want the max value, which will be reflected by the scrollbar being
scrolled "all the way down," to make the picturebox moved up to the
point at which all the buttons are visible, the last one being in a
position above the bottom of the container picturebox.

Some information that will be important in making these calculations:
My MDI form is sizeable, and therefore the container picturebox's
height increases and decreases dynamically... however:
The inside picturebox (picButtons) is sized at runtime - basically its
height is calculated as follows: the command button count * the height
of the command buttons (they are all uniform in height) + spacing
value (240 twips, eg:) between each button * button count.

For example, 6 buttons at 700 twips each = 4200
6 buttons with 240 twips between each = 6 * 240 = 1440  (I know
there's only 5 spaces of 240 but I am allocating a buffer of 120
between top and bottom of the picButton container)
Therefore I size the picButton at runtime to 5640.

My initial approach was to calculate based on the height of picButtons
and the amount of space needed for each button (700+240=940)
representing a button's "segment space"... I went on a wild tangent
from here, trying to figure out that subtracting the amount of
segments that can currently fit within the height of the mdi window's
scaleheight, leaves remaining the amount of picButtons that will have
to be above the top (ie: -xxx .top value)... I just cannot seem to
make the calculations work.

Any assistance would be greatly appreciated. I would be happy to share
the project file when I am done so anyone here can enjoy this code.

Any questions or if I have been unclear about any aspects, please let
me know and I'll clarify.

I can also send my project file over to anyone if you want to have a
look at it.

Thanks all.

---Atreju---
Larry Serflaten - 28 Sep 2004 04:40 GMT
"Atreju" <someone@who.hates.junkmail> wrote
> I am creating a sort of menu bar.

> When the user clicks the arrows, the inside picturebox will scroll up
> or down in order to reveal more buttons. However, I want the min value
[quoted text clipped - 5 lines]
> point at which all the buttons are visible, the last one being in a
> position above the bottom of the container picturebox.

To do that, how about you place the top button 120 twips down from
the top and then adjust the picture box to be 120 twips beyond the last
button.  That means you set the picturebox size every time you add
buttons, and you only have to work on calculations that use the size
of the picture box in your Resize code.

> Any assistance would be greatly appreciated. I would be happy to share
> the project file when I am done so anyone here can enjoy this code.

It would be better to move just this problem to a new project, and get
it working there.  That can be passed back and forth, without the rest
of your project.

LFS
Larry Serflaten - 28 Sep 2004 04:48 GMT
> > Any assistance would be greatly appreciated. I would be happy to share
> > the project file when I am done so anyone here can enjoy this code.
>
> It would be better to move just this problem to a new project, and get
> it working there.  That can be passed back and forth, without the rest
> of your project.

That didn't come off as I planned.  The part that should have been quoted
was:

> I can also send my project file over to anyone if you want to have a
> look at it.

Sorry!
LFS
Atreju - 28 Sep 2004 13:21 GMT
>"Atreju" <someone@who.hates.junkmail> wrote
>> I am creating a sort of menu bar.
[quoted text clipped - 14 lines]
>buttons, and you only have to work on calculations that use the size
>of the picture box in your Resize code.

The only thing is I am not using those "scroll" buttons that the real
Outlook Bar uses, I'm using an actual Vertical Scrollbar control.

In actuality, I already have it working with buttons! I just think
that working with a scrollbar is easier for the user. In Outlook I
understand why they do it like that because the buttons are clustered
in groups and hitting a button changes group. However, my buttons are
going to act like a menu of items that will all be lined up together.
Therefore I want to be able to scroll through all items at once.

>> Any assistance would be greatly appreciated. I would be happy to share
>> the project file when I am done so anyone here can enjoy this code.
>
>It would be better to move just this problem to a new project, and get
>it working there.  That can be passed back and forth, without the rest
>of your project.

Good idea. I will do that so that anyone who wants can take a look at
it. I will post a URL for it soon.

>LFS

---Atreju---
Jeff Johnson [MVP: VB] - 28 Sep 2004 14:17 GMT
>I am creating a sort of menu bar.
> What I have is an MDI window as my main application window.
[quoted text clipped - 3 lines]
> vertically with a bit of space between them. I am figuratively
> emulating what you may have seen in MS Outlook - the "Outlook Bar."

As an aside, if you're looking to create an Outlook-style application, I
HIGHLY recommend you don't do it with MDI. Instead I suggest that you design
your "child forms" as UserControls and load/hide/show them as necessary.

If you actually want the user to be able to view multiple forms at one time
then disregard this, but then it's not an Outlook-style app.
Atreju - 28 Sep 2004 14:51 GMT
>>I am creating a sort of menu bar.
>> What I have is an MDI window as my main application window.
[quoted text clipped - 10 lines]
>If you actually want the user to be able to view multiple forms at one time
>then disregard this, but then it's not an Outlook-style app.

Have a look at the link I posted in another post. It is not going to
be exactly like Outlook, and yes, I want the users to be able to view
multiple forms at once. I do want it to be MDI.

The only thing I need help with is the calculations needed to scroll
the buttons.

Thanks.

---Atreju---
Atreju - 28 Sep 2004 14:50 GMT
Here's a page with a description of my dilemma and a link to download
sample project:

http://dtsoftware.tallerworks.com/projects.htm

Thanks.

---Atreju---
Atreju - 28 Sep 2004 14:57 GMT
SNIP

I think I may have solved my own question!

I will post again if I need more help.

---Atreju---
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.