I have spend already many hours to find the reason of my current problem.
I have a CDockablePane, in which I am placing a lot of CStatic controls. The CStatic controls I am using to display bitmaps. A dockable pane is designed for resizing at any time. Therefore I try to recalculate the positions of each CStatic after OnSize is called.
With some CStatic controls it is running well. But when I am adding an additional control, I am getting strange problems: The pane is not repainted properly and OnPaint is recalled cyclically.
My code (partially):
class CPaneCtrlPLC : public CDockablePane
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
I was able to strip the OnPaint(0) function to a minumum to reprocude the problem.
If I comment out the re-positioning of the m_Ctrl_test, everything works fine, but with this statement I have the problems.
The CEdit class inherits from CWnd so you can use SetFont to change the font. You can probably set the background colour by subclassing the window. Changing the colour and image in a button can be done in similar ways. Google should find you some samples.
I have a dialog of radio buttons, 100 of them
I use this to select type of material product is made from so I can select correct ink for printing. Selections are everything from alumininum, plastics to wood.
I would like to select 1 radio button and have it return
the int of that selection without having to add an event handler for each and everyone of the radio buttons
Is there a routine that can handle any check on any button?
If(any button is checked) return(int # of the button)
you have busted my bubble.
To me, it seemed easier to look at a dialog page
with radio buttons rather than search a listing
especially for my printers who may not have to learn how
to use drop down list boxes
Seems to me that the program knows when a radio button
is selected and then marks is as such and turns off all others in the group..
I was hoping I could intercept the routine and just
add my own function to it.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
I have 3 functions that do sorting on a CArray.
CArrays are declared in header file:
// Do sorting for m_Integer here
// DO sorting for m_String
// Do sorting for m_Double
Now what i want to do is, have one generic function and then pass the CArray to that.
So far what i did is,
in Header file:
void sortAll(CArray<void*,void*> m_Array);
in CPP file:
void sortAll(CArray<void*,void*> m_Array)
int size = m_Array.GetSize();
m_Array.GetAt(0); // Error here
The error is that, it needs a class type and not a void type.
I am not sure how to proceed with writing a generic function to handle all different data types in one.
Any help is welcome!
I need to work with callback functions between different classes. With VS2010 I have done this already different times without any problem.
With VS2015 I cannot compile such code!
in Header in Class Declaration:
bool ProvideItemData(int nItem, int nSubItem);
//using namespace std::placeholders; // for `_1`
m_ListCtrl.SetOwnerData(std::bind(&CBlockEditView::ProvideItemData, this, std::placeholders::_1));
declaration in called class:
bool SetOwnerData(std::function <bool(int nItem,int nSubItem)> callback);
When compiling in VS2010, I get weird error messages:
c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(1501): error C2440: 'return': cannot convert from 'std::_Unforced' to 'bool'
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(1501): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\functional(210): note: see reference to function template instantiation '_Rx std::_Invoke_ret<_Rx,_Callable&,_Ty,_Ty>(std::_Forced<_Rx,false>,_Callable &,_Ty &&,_Ty &&)' being compiled
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\functional(208): note: while compiling class template member function 'bool std::_Func_impl<_Decayed,_Alloc,_Ret,int,int>::_Do_call(int &&,int &&)'
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\functional(136): note: see reference to class template instantiation 'std::_Func_impl<_Decayed,_Alloc,_Ret,int,int>' being compiled
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\functional(339): note: see reference to class template instantiation 'std::_Is_large<_Myimpl>' being compiled
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\functional(318): note: see reference to function template instantiation 'void std::_Func_class<_Ret,int,int>::_Reset_alloc<_Ty,std::allocator<int>>(_Fx &&,const _Alloc &)' being compiled
I do not find any solution. So at the moment I do not have any idea, how to solve this issue!
Last Visit: 22-Oct-20 23:21 Last Update: 22-Oct-20 23:21