Add a tooltip to a CStatic Ctrl - c++

Is it possible to add a tooltip to a CStatic control in Visual C++6? How?

Sure, you can use a CToolTipCtrl in order to add tooltips to any part of your window, dialog or control.

Related

Qt: Disable a Push Button without turning it gray

I need to make a checkable Push Button in Qt 4.8 that when is checked it becomes disabled.
The problem that I have is that the button turns gray and I need to keep it with the same color always. I have two questions for two possibles paths to follow:
1) Is there a way to disable the gray out effect when I use button.setEnabled(false)?
2) Is there a way to hook the click event so I can "simulate" the disabled property?
Thanks in advance!
[Edit] To give a little context, I have two push buttons that should toggle each other and that's why I need to prevent clicking on a pressed button.
Try button.blockSignals(true). You could also overwrite the look of the button when its disabled with a Qt style sheet.
To give a little context, I have two push buttons that should toggle
each other and that's why I need to prevent clicking on a pressed
button.
You should use QButtonGroup instead.
The only way that the button should be unchecked is when the user
checks the other button...
From doc:
In an exclusive group, the user cannot uncheck the currently checked
button by clicking on it; instead, another button in the group must be
clicked to set the new checked button for that group.
For disabling toolbutton and put icon of your choice instead of turning into grey
you have to load icon creating QPixmap object say qpm,
create QIcon object say icon
icon.addPixmap(qpm,QIcon::Disabled,QIcon::On) this line will show icon
setIcon on toolbutton
setStyleSheet
When enabling Toolbutton just change
3. icon.addPixmap(qpm,QIcon::Normal,QIcon::On)

Propertysheet Dialog box not dispaly propery in Windows 7

I have an application which has Propertysheet dialog box with PropertyPage and dialogbox has three button at the bottom.
PropertySheet and PropertyPage create using MFC CProperySheet and CpropertyPage.
Dialog box display fine in windows xp but in windows 7 its partially cut three button
Please Help me to resolve this problem
It's probably due to the font size being something other than default size (check the DPI in the Display properties). If you're manually sizing the property sheet you'll need to be aware that the dialog units will be multiplied by a factor to calculate the size for a given DPI.
Let me clarify:
Are you embedding property sheet in a dialog?
If yes:
Is there any reason to do so?
The buttons you mention belong to a dialog or property sheet?
Are you resizing property sheet?
If buttons belong to the dialog are they cut by the bottom of the dialog?
The best if you post a snapshot of the dialog from XP and 7.

how to set the controls right aligned with the view in MFC SDI application

I have created a MFC SDI application, and the view is derived from CFormView, so i can put some controls on the dialog. I have put a groupbox at the right side of the dialog and put some other controls inside the groupbox, such as edit box etc.
What i want is the groupbox and the controls inside right aligned with the dialog when i am resizing the view, just like the followingbehavior in C#: set the anchor property of groupbox to be "Right"
The EasySize is what i want

Need help adding scroll bar to edit box

I'm making an MFC dialog-based application in Visual C++ 2005. I added a scroll bar to an edit box. How do I program the scroll bar to make it work?
The windows styles wS_VSCROLL and WS_HSCROLL control if there is a scroll bar present or not. Normally you just setup these styles as part of the resource dialog template.
With MFC you use the "CWnd::ShowScrollBar" method to turn the scroll bar on/off.
When scrollbars are turned on, then they should work automatically for edit controls. You don't need to do anything.
http://www.functionx.com/visualc/controls/scrollbar.htm
has code you can use to control the scroll bar.

How to SetFocus to a CButton so that the border and focus dotted line are visible?

I created a simple dialog-based application, and in the default CDialog added three buttons (by drag-and-dropping them) using the Visual Studio editor.
The default OK and Cancel buttons are there too.
I want to set the focus to button 1 when I click button 3.
I set the property Flat to true in the properties for muy buttons.
I coded this:
void CbuttonfocusDlg::OnBnClickedButton3()
{
// TODO: Add your control notification handler code here
GetDlgItem(IDC_BUTTON1)->SetFocus();
Invalidate();
}
But the boder in button1 is never drawn. The caret (the dotted line indicating focus) is only drawn if I pressed TAB any time before clicking button 3.
I want the button to look exactly as it looks after I click it. Showing the dotted line inside the button programatically, would be a plus.
What I want:
What I get:
Use WM_NEXTDLGCTL.
See Reymond Chen's "How to set focus in a dialog box":
void SetDialogFocus(HWND hdlg, HWND hwndControl)
{
SendMessage(hdlg, WM_NEXTDLGCTL, (WPARAM)hwndControl, TRUE);
}
By calling UpdateWindow, the button is being redrawn before the focus change can take effect. The Invalidate should be sufficient by itself, the window will get repainted when everything settles down.
This draws the thick border around the button:
static_cast<CButton*>(GetDlgItem(IDC_BUTTON1))->SetButtonStyle(BS_DEFPUSHBUTTON);
A more elegant way to do this would be to define a CButton member variable in CbuttonfocusDlg and associate it to the IDC_BUTTON1 control, and then calling
this->m_myButton.SetButtonStyle(BS_DEFPUSHBUTTON);
This makes the button to which I'm setting the focus the default button, but note that when the focus goes to a control (inside the dialog) that is not a button, the default button is once more the original default button set in the dialog resource, in this case the "Ok" button.
I am following Joel's suggestion. But slightly different with the API used in that link, my one is :
PostMessage(WM_NEXTDLGCTL, (WPARAM)(pwnd->GetSafeHwnd()), TRUE);