Is there a way to add a ToolTip to an MDI Parent Form in VB6? - vb6

I'm currently working on a project that utilizes an MDI Form. What I would like to achieve is that when the user hovers over one of the menu options in the MDI menu, a ToolTipText appears describing what can be found in said menu. I'm aware of the fact that in some options for VisualBasic 6, ToolTip is supported. However, I can't seem to add this to the MDI Form, or add a label control for that matter. Has anyone ever run into this problem, and if so, is there a workaround or a solution?
Please let me know if you have any additional questions or comments. Thank you in advance.

I'm not aware that any true menus on a VB6 for (even non-MDI) have a tool-tip property; hence, neither does the MDIForm when one its child forms has its menu displayed.
However, there are a few controls that can be put on the MDI parent form. The most useful of these is probably the PictureBox, into which you can then place any type of control, such as CommandButtons. It must be "docked" to either the top or bottom of the MDIForm, using the PictureBox.Align property. Controls within the PictureBox can be located any way you wish, and can have their normal ToolTip properties set.
Another MIDForm-usable control that I've had good luck with is the ToolBar control, which comes in as part of the CommonControls component. Like the PictureBox, it has a .Align property to set it to the top or bottom of the MDIForm. You can put any reasonable number of "buttons" on it, and have reasonable control over their appearance (graphics, etc.); apropos the OP's query, you can assign a ToolTip to each button. It wouldn't be difficult to have the buttons change depending upon the currently-active form, just as the MDI menus normally do.

One other alternative that can be considered (but may be quite tedious to implement) could be reading the Mouse.X and Mouse.Y properties for each MDI menu and setting the captions of a Label control (or TextBox) using the Mouse Hover event.
You'd need to find the top left and bottom right points for each MDI menu and if it is within the box, you can show your label control with the intended caption. But note that you can't just put any controls on an MDI Form except maybe PictureBoxes, Toolbars and Coolbars, etc.
So the Label or TextBox control would have to be first placed on top of a PictureBox control which can be top aligned.

Related

Firemonkey TComboColorBox hiding color picker

Is there a way, after selection of a color, to programmatically hide the color picker of the TComboColorBox? I've searched on the web and Embarcadero community but couldn't find a way to do this.
The answer is no, there is no designed way to hide (collapse) the popup programmatically. And you did not explain why you think it would be necessary to have.
Keep in mind that there are 4 subcontrols, that the user may want to use:
a THueTrackBar,
an alpha channel trackbar,
a color quad, and
a hex color value edit box.
An automatic collapse of the popup would be just annoying.
The user can at any time decide to close the popup simply by clicking on the constantly visible bar.
With reference to your comment:
After your answer, I realized that I must implement a color picker component that shows a rect containing a TComboColorBox and a TButton as childs. Clicking the child button, in turn, hides the container rect itself.
I have told you twice that the user can close the popup part of the TComboColorBox simply by clicking on the component (the base part of it).
In fact, the user can click anywhere outside of the popup window in order to close the popup window. The popup is closed immediately when the focus moves away from it.
In my opinion there's no need for a special "Close" button.

Win32 Dialog box: how to keep all objects in windows centered when resizing

I am building and maintaining a Win32 app using Visual Studio.
I have recently edited the .rc file adding WS_THICKFRAME to my dialog STYLE line for all dialog windows to allow them to be resizable.
My current problem is, when I resize a window, its content remains fixed to the left. How can I make the window's content remain centered when resizing using the border?
Pointing to any relevant documentation on this would also be helpful, as I have not had lucky finding that.
If you only want to reposition (rather than resize) the individual controls, an easy way would be to create a non-modal container dialog to hold the controls, make that dialog a child of the resizable dialog, and then when you handle WM_SIZE for the outer dialog, you only have to reposition that one non-modal dialog.
Your new position is ((newWidth- controlDlgWidth) / 2, (newHeight-controlDlgHeight)/2), where controlDlgWidth, controlDlgHeight are the width and height of the child dialog.
I say to use a non-modal dialog for this, so that you can continue using a resource script, rather than needing to add a whole bunch of explicit CreateWindow() calls.

How to create consistent toolbar buttons with icons

Desired look
I wish to make a toolbar for my app that will contain some simple buttons, each with a single monochromatic icon. Here is an example of some toolbar buttons similar to I'm trying to achieve, from Mail's compose window:
Notice these buttons have a consistent size, inner padding, padding, and shading. This is a pretty consistent style across macOS, present in Mail, Safari, Finder, etc. This leads me to suspect there's a standardized UI component for creating such buttons.
If I use a segmented control, each button looks correct, with each icon being correctly padded:
Now I would like to add individual buttons that match the style.
Attempt 1
My first attempt was to add a "Push Button" (NSButton) to the toolbar:
This resulted in a wide button that's a bit too short, and not lined up with the segmented control:
Attempt 2
My second attempt was to use a segmented control, with only 1 segment.
This resulted in a button that's the right shape, size, etc., but it was off center relative to its label.
Naturally, I can manually adjust the button to match the goal, but I feel like I'm missing something. What's the proper way to create these standard buttons?
This is actually quite easy to do and you were close already.
You can use NSButton for that. Note that it has different styles (defined in NSButton.BezelStyle) to choose from. The default one is the one to use inside windows and modals. But for toolbars, to match the style of segmented controls and search bars, you can choose the style .texturedRounded.
You can also set the style via Interface Builder. Note that you have to select the button itself, not the toolbar item around it.
To get the correct size, you seem to set the icon within the toolbar item, not the button itself.
Here is my result:

dojo Show/Hide One ContentPane While Another ContentPane Is Liquid

I've been struggling for weeks trying to crack this nut so I'm not sure if it's impossible, or if it's my lack of coding chops... or both. I'm not a programmer and I'm a newbie to Dojo Toolkit.
I have a site using the BorderContainer layout. I'm trying to create an effect where I can use a button to open and close a dropdown type box that will contain controls. I need this dropdown to be hidden on page load, and then open when you click the button.
My problem is that when I open the dropdown, it pushes the content pane below it off the bottom of the browser window. I need the lower ContentPane to stay fit within the remaining space of the browser window when the dropdown opens. Additionally, I want the dropdown to sit outside of the scrollable container for the content below it, which is why I have it set up to sit outside a nested BorderContainer below it.
I've created a simplified version of the code to demonstrate my challenge (see link below). If you load the page you can see the center ContentPane scrolls the content. But, if you then click on the button, a dropdown div expands above the content. Then when you scroll, you'll notice that you can't see the full pane because it's in no-man's-land below the bottom of the browser window. I assume that because the div is set to display:none on load, it's size is not accounted for on page load. Then, when you open it by pressing the button, it's size is additive and the pane below doesn't know how to resize or account for the new element.
I've tried using the visibility attribute, but that leaves a gap for the div when it's still closed. I've tinkered with some code that controls the height that shows promise, but each of my dropdown boxes will be different sizes so I'd prefer that the height be set to "auto" rather than a specified pixel size.
Does anyone have any idea how I can accomplish this so that the lower pane will fit in the space without pushing off the screen?
Here's a sample of the page:
http://equium.com/scaffold.html
(I had some problems trying to insert the full HTML page here as a code sample so if that's a preferable way to handle it, and someone can let me know the best way to embed all of that code, I'd appreciate it.)
Thanks is advance, I'd really apprecaite anyone's feedback.
You might want to take a look at dojox.layout.ExpandoPane (though be warned I think it has only worked properly for top and left regions for a while).
Also, I'd suggest simplifying/altering your layout a bit. See example here:
http://jsfiddle.net/taFzv/
(It'd probably need some tweaking to get exactly what you want.)
The real issue you're having is probably that the BorderContainer has no idea that parts of the view resized. ExpandoPane takes care of that by telling the BorderContainer to re-layout after its animation completes.
It works under IE8.0. When dropdown box open, just keep pressing mouse from page and drag to bottom, you could see the content was pushed to out of page. It looks the browser could not detect it and could not add it to "scroll bar" account.
I would suggest taking out all BorderContainers except your top level one, the one with mainPage as the id.
Place your {stuff here} div into the mainPage BorderContainer, after the ContentPane with the Close/Open button. Make sure you make it dojotype dijit.layout.ContentPane, set up layoutpriority, and set region to top. Set the height to 0/x when clicking the Open/Close button, instead of setting display.
Try your page again. If that doesn't fix it, you probably need, a call to layout, resize, or both to indicate to the BorderContainer that it needs to evaluate all its children and size the "center" pane properly. Something like dijit.byId("mainPage").layout(); Do this any time someone presses the Close/Open button, after you have changed the height of any BorderContainer children.
Maybe the dijit.form.DropDownButton would fit your needs. When click the button a tooltip is displayed that can be filled with any content you want. Just as you specified, the dropdown tooltip is only displayed when you click the button, and it doesn't mess with the underlying layout at all. The tooltip sits "on top" of the page.

What Qt4 widgets should I use and how to approximate a ribbon-style interface?

I am trying to create an interface for my application using Qt Designer. I want it to have a tabbed, ribbon-style set of controls at the top, and a MDI-style area with docked windows which I plan to show and hide depending on which tab of the ribbon is currently selected. I am just beginning with Qt Designer as well as Qt4 itself for that matter so I'm not quite sure how to setup the window, which widgets and layouts should I use etc.
It's quite obvious there should be a QTabWidget at the top, but I'm not sure about the bottom. Should I use a QFrame? A QMdiArea? A dock widget? What layouts can I use to make sure the tab widget has a fixed height, occupies the whole width of the window at all times and the bottom area scales as the window is resized?
I've read in the manual that splitter layouts allow for manual adjustment of the size of the widgets they contain, but I can't drag the box size of a widget after I place them inside a splitter. Thus I'm unable to setup the area below the ribbon. Anyone, help?
You should look into the QMainWindow and check the multiple utilities it can provide you (Toolbar, StatusBar, DockWidgets, CentralWidget, etc...).
The way I understood your case is that you will always have the MDI Area visible, and that the tab bar will only be used to change the dockWidgets. Here's how I would do it.
The centralWidget of the mainWindow would be a QWidget with a QVBoxLayout containing a QTabBar widget first (up) and a QMdiArea under it. The sizes should be handled automatically.
This will allow the user (or you) to dock widgets on the left, bottom, top or right areas of the mainWindow's central widget. Keep pointers to the dockWidgets to be able to move and show/hide them at will.
Hope this helps.
VTK Designer, which is built on Qt, has a Ribbon-ish interface. You might take a look at the source code for reference.

Resources