|
Thank you.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
One more strange behavior of stuff in CPropertyPage ( see CListCtrl selecting item inconsistent bellow) .
I cannot select the CEdit control using mouse ( to enter text) , but it works using tab and when I test the dialog by itself.
Would someone be kind enough to try this on the latest and greatest MS VS?
I am about to reload my IDE, and it but it would be nice to know before I spent hours doing that.
I really appreciate this forum help.
Cheers
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: ...and when I test the dialog by itself. So it works fine on a dialog but not a property page?
Vaclav_Sal wrote: Would someone be kind enough to try this on the latest and greatest MS VS? VS2013?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Yes, when I test the dialog flipping the ON/off switch in resource manager it works.
I did build a simple dialog based test app ( CFormView ) and it works there too.
As I said, I got too many fires going - the other one is that my CComboBox won't sort dynamically added items, only the initial "static" data.
I really feel I need to reload VC 6.0 or "upgrade" to whatever. Too many strange problems.
But my serial control of my radio works, one atta boy!
Cheers Vaclav
|
|
|
|
|
Next time my XP crashes I'll install VS 2013 and test this.
I cannot do it now, last time I "upgraded" to VS I ended up reinstalling both clean XP and VC 6.0!
It reminded me going from VB3 to VB4 fiasco. To risky.
Cheers Vaclav
|
|
|
|
|
I have a C++ application that has 3 functions. The first is the standard int main entry point function. The other function is a simple test function void Test(). And finally the 3rd is a analysis function that takes several parameters one of which is a std::vector. Both the main and Test function pass the same parameters to this analysis function. In theory these 2 functions should return identical results. However they don't. The main function is called from a command prompt and the other function is called from a python script. I have eliminated marshaling issues by not passing parameters to or from the Python environment. The Python environment simply calls the test function. However after placing print statements throughout the library I have seen that the results are completely different. Does anyone know of any memory model issues or threading issues that can occur between these 2 environments that might lead to something like this.
void Test();
void Do(std::vector<int> &x, int search);
int main(int argc, char* argv[]) {
std::vector<int> x; int search =8; Do(x,search);
}
void Test() {
std::vector<int> x; int search =8; Do(x,search);
}
void Do(std::vector<int> &x, int search)
{
}
I don't want to bother with the Python code here though it just calls the test function...it appears to run so, not sure what else it has to do other than wait for the C++ library to finish.
nothing
|
|
|
|
|
You should see that from this info it's impossible to tell what's wrong with your code. The only valid answer is: debug it.
If you are using multiple threads then make sure that there are no race conditions as the first step. You should know what kind of threads present in your system. If you don't know it then its a big problem, then try to find it out with your debugger.
Lets assume that you have no race conditions or you have eliminated all of them. The problem is obviously not the contents of main() and Test() even in case of multiple threads because they use just local variables and they contain the same code. You Do() function does the following: It puts together a result by using the input parameters and some variables (state) inside your program. The input parameters of Dd() are always the same so the only difference between the calls from main() and Test() can be that the code of Do() (and the code of all function calls performed by Do()) see something different in your program state when it calculates the result.
So the difference in your program state can have several different reasons:
1. You simply fill different values into some variables before calling Do() from Test() and main()
2. You have some bugs in your program for example uninitialzed variables or memory overwrites. For this reason your Do() calls may see different values in some variables used for the calculation of the result.
3. If you have multiple threads and they are modifying the same internal variables used by Do() even with proper synchronization without race conditions then don't be surprised if Do() may return completely different results for the same input parameters if it uses some variables that are shared with another thread and modified randomly by another thread.
Check out your code and check what kind of data is used by the Do() function besides the input parameters to put together the result! Check all code that possibly modifies these variables. Start debugging!!!!
Use your debugger: First put a breakpoint into Test() and check out which thread calls it and what is the callstack. Probably you have called into the python interpreter from your program and the same thread called back into C++ but who knows, its your code and you keep it a secret right? After this execute the call into the Do() method step by step from both the main() and Test() methods and try to find out where is the difference between the two calls. Its boring like debugging anything else...
|
|
|
|
|
Well Thanks for taking a stab at it, I know this post wasn't much to work with but I am dealing with various constraints none the less. I have not found an answer for this behavior yet, but I will continue to look for one.
nothing
|
|
|
|
|
You are welcome! Definitely check out the meaningful threads in your prog and the callstack on which python calls your C++ code. Without that you are just blindly navigating in fog... Check out the bottom of the callstack that calls into python when the breakpoint in Test() fires. If you are good then it is the very same (Main) thread that you are using. Still interference with other threads as the result of bad threading design can be evil when it comes to unpredictable program state used by your Do().
|
|
|
|
|
how to write a program in which whatever the user types into program is typed into microsoft word letter by letter....like i paste the essay of 10 pages into the program n the program gives the same in ms word letter by letter......plzz help
i know i can just copy paste it or just type into ms word directly but still i need the program..
|
|
|
|
|
|
|
Extend your legal chess move identification program as follows:
• Allow the user to add an arbitrary number of pieces to the board (either red/black or
white)
• Allow the user to select a given piece and then that piece must work out its set of
valid moves from its current position
• A piece cannot move over a piece which is the same colour as it is
• A piece may move over (and replace) a piece which is of the opposite colour.
• Create a Visualiser Abstract Base class which implements a show() pure virtual
function
• Create a TextVisualizer derived class which overrides show to display
the chess board (with legal moves for the selected piece) to the standard
output stream
• Create a GraphicalVisualizer derived class which overrides show to
display the chess board (with legal moves for the selected piece) as an
image.
|
|
|
|
|
go do your own homework
OR
alternatively ask Christian Grass to help you out. I know him well and he enjoys walking new coders through their homework exercises.
B
MCAD
---
|
|
|
|
|
At least this kid is smart enough to remove school/ college name from the assignment text....
|
|
|
|
|
But that smartness is negated by forgetting to omit "Allow the user."
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Reading this[^] may help. Be sure to read at least items 2 and 11.
|
|
|
|
|
Raymond5056584 wrote: Extend your legal chess move identification program as follows:
This made you think it was the right time to extend also the Lounge the forum tolerance to homework programming requests?
(Lounge? I need more caffeine, this morning...)
Veni, vidi, vici.
|
|
|
|
|
I have a CListCtrl control with single column (item only , no subitems yet) containing text “COMX” - list of all COM ports in the system.
I can select the first and last COM port with mouse pointing to letter "C" only.
The mouse cursor changes when the mouse is over “OMX” part of the entry.
All of the other ports can be selected with mouse anywhere over the “COMX” text.
Is this normal or user error?
Cheers
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: The mouse cursor changes when the mouse is over “OMX” part of the entry. Is the item just a simple text string or is there something special about it?
Use the best guess
|
|
|
|
|
Just plain text , the first one is " COM1:" , and here is the code processing the click. But that is after the selection so it should not matter.
<pre lang=" LPNMITEMACTIVATE pia = (LPNMITEMACTIVATE)pNMHDR;
CPoint point(pia->ptAction);
// Select the item the user clicked on.
UINT uFlags;
int nItem = m_list.HitTest(point, &uFlags);
CString strText = m_list.GetItemText( nItem, 0);
SetDlgItemText(IDC_EDIT3, strText);
*pResult = 0;"></pre>
|
|
|
|
|
|
Nice, but...a little issue with MS terminology, as always.
The item is not really "selected", that to me implies some outside act.
I have been using POSITION iterating thru document / view the term used there is "get".
But I am just too picky.
I have a feeling the problem is related to PropertyPage "dialog".
Been having problem selecting CEdit control using mouse ( it works fine using tab) and just "discovered " when I run the dialog test by itself it works just peachy , but won't work in ProperyPage.
Maybe this selection issue is related. I'll try to run the dialog outside PropertySheets to see if it works differently.
Don't spent too much time on it, it is just annoying , but I can live with it.
Vaclav
|
|
|
|
|
In your message handler, you could try:
int nItem = m_list.GetNextItem(-1, LVNI_SELECTED);
CString strText = m_list.GetItemText(nItem, 0);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|