VBA Vertical scrollbar thumb size - excel

I have a form where controls are dynamically created, the scrollbar included, with
Set theScroll = UserForm1.Controls.Add("Forms.ScrollBar.1", "sc1", True)
but I'm having difficulty resizing or changing the scrollbar thumb size other than the min value, it doesn't seem to have an event or function for resize.
I've also tried using
Userform1.ScrollBars = fmScrollBarsVertical
but I can't move it anywhere around the form since I need to have the said scrollbar slightly off of center of the form.

Related

How to make a vertical slider?

I need a vertical slider similar the standard slider. Is there a way to modify the existing one or do I need to make a new one?
The standard slider would work for me. I just need it to work vertically.
Perhaps I should better clarify my issue with the standard slider.
Yes, I can drag the size of the slider and it will be vertical. The problem is that when you select the value of the slider to show the text gets buried in the low side of the slider when you slide it down all the way. It essentially gets cut off and only shows the top half of the slider value character. I find no way to correct this by moving the shown text up a little so it all shows. I see no way to change text vertical or offset position in the properties setting.
The text settings only allow you to change the text format to right, center and left justify. There is no setting that can move the text up to prevent it from being cut off when the slider is all the way to the lower or down position.
The value text shows ok on the top of the slider. The problem is on the bottom side when you set the slider to be vertical.
It looks like the the show value setting does not place the value on the top layer of the slider and it gets hidden behind something else in the slider object.
LC9, Windows 10
I think I'm understanding your question. If you just resize the horizontal slider control so that the width is narrower than the height, the orientation of the slider control will automatically change to vertical.
Apparently it is a bug in this version of LC. At least in Win which is where I am testing.
Putting the scrollbar vertically cuts the value when it reaches the bottom.
But I found a solution so that it does not cut. Play around with the properties of the font. Such as size and family. In my case it worked fine by lowering the font size by one pixel.
Default: Segoe UI font, size 12
I just set the size to 11 and it doesn't cut anymore.
For what it is worth, I do not see this issue on a Mac. A vertical slider works as advertised. Font size makes no difference.
Are you saying that in the horizontal mode, you do not see this, but when changed to vertical, you do?
Try creating a scrollbar and a text field.
Set the scrollbar's showValue property to false and copy the following script to your scrollbar. Note that your field must be called "scroll value".
on scrollbarDrag pNewPosition
local tLoc
lock screen
# The Current Loc of Field
put the loc of field "scroll value" into tLoc
# New Position of scrollbar
put pNewPosition into field "scroll value"
# New Loc of Field
put the mouseV into the item 2 of tLoc
set the loc of field "scroll value" to tLoc
set the left of field "scroll value" to the right of me
unlock screen
end scrollbarDrag

Why does Excel 2010 VBA userform textbox font changes depending on size of frame?

I have a userform with several frames, labels, and textboxes, all set to a default font of Calibri Regular size 10. I noticed the font in one textbox was different than the rest; a bit slimmer, a hair shorter and more condensed than the default. I tried adjusting the font in design and runtime, messing with the font of the frame, and replacing the textbox with a new one, but nothing seems to correct the font.
Then, by accident, I moved the textbox position up a bit and the font automagically corrected itself. Weird. I've since been playing around with the textbox position and frame size. This is what I've observed:
1) The font size is dependent on the relative position within the frame; the textbox needs to be entirely in the top 50% of the frame height, and adjusting the textbox position OR frame height affects the font.
2) This issue applies to more than one frame on this userform.
3) This issue applies to labels as well as textboxes.
4) This issue is inconsistent and does NOT apply to all textboxes and labels; it's just the textboxes affected in the first frame, just the labels in a second frame, and there is no font issue in a third frame.
I've gone over the properties in all frames, labels, and textboxes in design mode and nothing stands out. All of these controls have the same font set. Has anyone ever encountered this issue before? Is this a known bug?
Same as #SquirrelBait - I too have found that the display size of the font changes in appearance depending on where it is positioned on my UserForm (created at Design time - Excel 2016). This occurred within a Multipage, but may not be relevant.
Although I don't have a solution, I may have a possible work around:
The issue only seems to occur where the Height of the Form Control (Label, TextBox, ComboBox) isn't an integer value. I auto sized some of my Controls so they were given Heights of 14.25, 28.5, 20.25 etc. I've increased all the Heights to integer values. Now the issue appears to be resolved.
I also had success changing my textbox heights from 17.5 to 18. In my case I also had them slightly overlapping (to create a table effect), which despite them being 18 font, still caused them to have a slightly larger text size. After I changed it so that the bottom of one is the top of another, everything seems to be working fine now.

VBA- partially zoom in to the Designer

I wanted to change some small controls by selecting and arranging them. they are at the bottom right corner, so when I use the usual zoom in, they go out of sight and became inaccessible from my screen. is there any way I can just zoom into my desired controls or set of controls? Also, I can't resize the designer itself, as I already using its maximum width.
Thanks for any help.
In the properties, , select ScrollBars #3, the Set ScrollHeight and Width to 150% of your form hight and width.

react-virtualized List component extend height of last row

I have a List component from react-virtualized where I am using the height prop to set its row height. However, the horizontal scrollbar is overlapping with the last row, making it hard to see the text content of the last row. Is there a way to increase the height of the last row so that the horizontal scrollbar doesn't overlap with the text. Doing this dynamically in code messes things up when one is dealing with a dynamic List growing in real-time. I tried using the last-child selector but had no success. Any insight would be appreciated.
The react-virtualized Grid component accounts for horizontal and vertical scrollbar size to avoid this problem. (You can see this on the Grid demo page.) However it's expected that the List component will not scroll horizontally so it will only account for the vertical scrollbar size.
If your UI needs to scroll horizontally, you may have better luck using a 1-column Grid.

Motif: How to move Scroll Bar automatically without user intervention

I have a scrolled window in my application, in which I have created a drawing area widget. In the drawing area, I have placed multiple images. When the user enters information about an image in a search box, the appropriate image gets highlighted.
My problem is how do I get the application to scroll automatically to the highlighted Image box without the user using the scroll bar. The scrolledwindow should automatically move the view region, to display the region where the highlighted Image is present.
The scrolling policy used on the scrolled window is XmAUTOMATIC.
Any pointers would be greatly appreciated.Thanks in advance.
Try XmScrollVisible() if this does not work then you will need to:
1. Find out the size of the work area.
2. Find out the size and position of the clip window.
3. Find out the max/ min values for the horizontal scrollbar.
4. Use XmScrollBarGetValues() for the horizontal scrollbar to get its position within the max/min values.
5. Do some math magic to determine how much to move the horizontal scrollbar to get the work area to show through the clip window.
6. Call XmScrollBarSetValues() with Notify = True.
7. Repeat for the Vertical scrollbar.
HTH

Resources