how to prevent vertical scroll bar in an owner drawn combo box when only 3 items exists? - visual-c++

I sub-classed a combo-box control to make text vertically centred. Issue here is I am getting a vertical scroll bar when only 3 or 4 items exists in the combo-box that too when I expand the control for the first time, where a vertical scroll is not required.
Control property had been set as follows.
COMBOBOX IDC_COMBOBOX,28,45,205,65,CBS_DROPDOWNLIST | CBS_OWNERDRAWNFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP.
When I removed WS_VSCROLL vertical scroll bar is not coming. But if I remove this property I will not get a scroll bar when too many items exists in the combobox, where actually a scroll is required.
Please find the below Images for your reference how the control is behaving.
Run the MFC application.
Expand the combobox.
Again try expanding the combo box issue is not reproducing. It's happening only
for the very first time when expand the control.
I could not figure out why this issue is happening. I tried removing the existing control and again I tried adding new controls expecting whether it could bring any change in the behaviour but no luck.
Item height is set to 30 as below.
m_ComboBox.SetItemHeight(-1, 30);
And I had two combobox controls in my properysheet application as shown in the image.
Any help is appreciated.

Related

Excel/VBA - Set Focus and Scroll to Control

I'm looping through the ActiveX controls on my spreadsheet to implement tab control. I have around 100 controls in my spreadsheet, so not everything fits on a single "page" (it's all in the same tab, you just have to scroll down.)
I can use Activate to set the focus to the next control. However, when I tab through the controls and pass the bottom of the viewable window, the window doesn't automatically scroll to show the control with focus.
Is there a way to get the spreadsheet to scroll so that the control that has focus is actually on the screen?
Sorceri nailed it right on the head. I used Window.ScrollRow to scroll down the page after I set the focus. The only issue is that this sets the bottom of the row to the top of the window, so it's just off screen. I was able to resolve this by specifying:
ActiveWindow.ScrollRow = row-3
Thanks!

Python + GTK - Scrolled menu bugged

Basically, when we click on a combobox near to the bottom edge of the screen, the first item of the menu begins at the same vertical position of the combobox, leaving a blank space on top of this.
This way the menu is created with the size to hold all the menu items, but since the first element of these is not put at the top of the menu, the menu has to scroll to see them.
Link to the image: http://postimg.org/image/767ukjphz/
It's not a bug in my code. The menu is created correctly. The bug is in the GTK libraries.
So, what do you suggest me?, how can I resolve this situation?, maybe moving to menu position?

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

Combobox not displaying the data items

I have been trying to add Data items for my combobox in the DialogWindow of my mfc project, at design time by setting strings delimited by semi-colons for the Data property of this combobox.
But it just shows empty combobox at runtime. I tried using AddString() method of this combobox manually in the OnInitDialog() event of the DialogBox too. But that was also not working.
Tried creating a demo project again and when I added the combobox and put the value a;b in the Data property of it, it is showing up. But tried the same on my project and it is still showing the empty list in the new combobox! Tried to compare both project's code, like the header files and initialization's etc. Found that both are same. Other than some event declaration for the buttons and my custom c++ code in my project, the rest of the code is same as that of the newly created demo project!
Why in my project this combobox is showing an empty list of items? :(
EDIT:
Just noticed that the items are already in the list. But the dropdown is of small height and thus preventing the actual items from showing up! :(
Tried to look increasing the size of the combobox, but I couldn't find any property in the Property Window and dragging the corners of th combobox doesn't increases the height either! :(
Increase the size of the dropdown list like this, in the design window:
Click on the arrow on the right side of the combobox (highlighted in yellow on first pic). Then click and drag the bottom mid resize marker to increase the height (highlighted in the second pic).
This will increase the size of the dropdown list.
Otherwise when we try to click on the resize markers to increase the height, it would be disabled. So make sure you click on the arrow on the right side of the combobox first.

Add fixed positioned Combobox inside FlowPane

I have a FlowPane which will hold many panels which are based on BorderPane.
I want to create ComboBox which will be used to filter the Panels by type. And the panels will be scrolled by ScrollPanewhen they exceed the visible area.
I want the combo box to scroll along with the FlowPane inside the ScrollPane. I want to get the result which is displayed into the picture. Can you tell me how I can get the desired result. I can very easy create BorderPanes and insert them into the FlowPane and the challenge is how to position the Combo Box and keep it always at this position.
Why don't you simply use another border pane?
Add your combobox to the top ( or additional flow pane with combobox on
it)
Add your Flowpane to the Center
Then scroll the whole border pane using the scrollpane?
What could be simpler?
Here's how you'd do it:
StackPane with 2 layers:
layer1: your ComboBox panel.
layer2: your ScrollPane with your FlowPane inside*.
*The trick is: just make your combobox panel background opaque, and some initial top inset on the flowpane so that it starts at the right place.

Resources