I want to use a CMFCRibbonEdit with SpinButtons in my ribbonbar. Therefor i call CMFCRibbonEdit::EnableSpinButtons(0, 10000). The Problem is, that the protected function CMFCRibbonEdit::CreateSpinButton() do m_pWndSpin->Create() without UDS_NOTHOUSANDS. How can i add the up-down control style UDS_NOTHOUSANDS later? There is only m_pWndSpin->GetStyle() but not function like SetStyle().
Do someone has any idea?
Maybe there is not SetStyle but there is a CWnd::ModifyStyle...
Related
I have the following wxDialog parent window:
I have created that parent window by the following code:
settingsFrm settingsWindow(this, "Settings");
settingsWindow.ShowModal();
I have tried to use FindWindowByName to get the value of the first text ctrl as follow:
wxLogMessage(dynamic_cast<wxTextCtrl*>(settingsWindow->FindWindowByName("keywords_txt"))->GetValue());
But unfortunately, it doesn't work and gives me a runtime error.
I don't know if that method suitable to do what I want.
How to get the value/other of a control through its parent window?
From your comments, it seems like you expect the function to find the control from the name of the variable in your code which is not how it works and would be pretty much impossible.
FindWindowByName() uses the window name (and, as a fallback, label, but this is irrelevant here because text controls don't have labels anyhow), so for it to work you need to set the window name when creating the control, using the corresponding parameter of its ctor. This is very rarely useful in C++ code, however, as it's simpler to just store a pointer to the control in some variable and use this instead.
FindWindowByName() can often be useful when creating controls from XRC, however. If you do this, then you should specify names for your controls in XRC and pass the same name to this function.
How did you create the TextCtrl instance? You should have something like wxTextCtrl m_textCtrl1 = new wxTextCtrl(/// arguments); Accessing the value should be very easy, as wxString text = m_textCtrl1->GetValue(); You definitely don't need FindWindowByName just for what you are trying to do here.
I am trying to prevent the anchor in the vtkCaptionWidget from being interacted with by the user (http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/CaptionWidget). It seems straight forward to just call something like:
captionRepresentation->GetAnchorRepresentation()->SetPickable(0);
or
captionRepresentation->GetAnchorRepresentation()->SetDragable(0);
however these do not appear to do anything. I have tried a number of different combinations of disable calls on the widget, representation and anchor representation. I think I am missing something.
Thank you,
Turn off the interaction of a widget by
myWidget->ProcessEventsOff();
It turns out what I actually wanted to do was disable the handle/leader component of the widget. To do this I had to create a new class that inherited from vtkCaptionWidget and then added the following function to disable the internal vtkHandleWidget:
void SetHandleEnabled(int enabling)
{
this->HandleWidget->SetEnabled(enabling);
}
I'm trying to make a custom sprite, which could receive touch and handle the function as callback.
Okay, first step, receive the touch, easy, we can search it online everywhere.
The one I couldn't do is, I want to make it receive SOMETHING in the class the sprite is created, a function that will be called when the sprite is touched.
I was searching on internet and I think (not really sure) that SEL_Callfunc can do what I want, but I couldn't understand how this one work, so can you guys give me an example please?
For example, my custom class is BSprite, so when I create new object in HelloWorld.cpp, it should be
BSprite* sprite = BSprite::create("HelloWorld.png",HelloWorld::TouchCallback);
Thanks for reading :)
sprite->addTouchEventListener(CC_CALLBACK_0(HelloWorld::onTouchSprite, this));
void HelloWorld::onTouchSprite() {
}
Note: onTouchSprite method should not have any parameters
I'm trying to use the standard icons in Qt for a QToolButton but I have a problem. My code is:
m_buttonZoomPlus->setIcon(QStyle::standardIcon(QStyle::SP_DesktopIcon));
I get the error message :
cannot call member function 'QIcon QStyle::standardIcon(QStyle::StandardPixmap, const QStyleOption*, const QWidget*) const' without object
What does it mean? Do I Have to create an empty QStyle object and call the standardIcon function on it?
Besides, I found a list of standard icons here: http://doc.trolltech.com/main-snapshot/qstyle.html#StandardPixmap-enum
Is this list exhaustive or are there other standard icons? I'm looking for instance for a zoom-in/out icon and I've not yet been able to find it.
Thank you very much for you help.
It means standardIcon is not a static method so you can't call it that way. You need to construct a QStyle and initialize it appropriately then you can use that method to get a specific icon.
Edit: Jeremy is right. If you aren't changing the style or defining your own style you can simply use the following:
QApplication::style()->standardIcon(QStyle::SP_DesktopIcon);
Reference: http://doc.qt.io/qt-5/qstyle.html#standardIcon
I've got a CRichEdit that I need to get the text from. What is the best way to do that? GETTEXTEX? StreamOut? If I go the StreamOut approach, what would my callback look like?
It's inherited from CWnd so you should just be able to use GetWindowText().
CString returnText;
yourRichEdit.GetWindowText(returnText);