|
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
|
|
|
|
|
David,
the "problem" is indicated by mouse pointer changes from howering over "C" to "OM1:" and than there is no event. The actual processing is fine.
And it does it only on first "COM1:" and last "COM5:" lines.
The "COM2:" thru "COM4:" it works on the entire text.
Richard,
just confirmed that in plain dialog app I can select the CEdit box using mouse.
I guess in my spare time I'll kluge some workaround. Perhaps real subclassing will work.
Vaclav
|
|
|
|
|
Sorry. I misinterpreted this:
I can select the first and last COM port with mouse pointing to letter "C" only.
What styles does your list control have?
"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
modified 22-Aug-13 11:28am.
|
|
|
|
|
David, it's the little details which will get you each and every time. Ha ha.
Have a great day.
Vaclav
|
|
|
|
|
I just added a list control to a dialog, changed its style to report, and added the following code:
m_list.SetExtendedStyle(LVS_EX_TRACKSELECT);
m_list.InsertColumn(0, _T("COM port"), LVCFMT_LEFT, 100);
m_list.InsertItem(0, _T("COM1:"));
m_list.InsertItem(1, _T("COM2:"));
m_list.InsertItem(2, _T("COM3:"));
m_list.InsertItem(3, _T("COM4:"));
m_list.InsertItem(4, _T("COM5:")); Now, no matter where the mouse hovers over any of the five items, that item will be selected after about 0.5 seconds.
"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
|
|
|
|
|
David,
same problem. Only works when then mouse is over "C" in first line.
I really believe it has something to do with CPropertPage.
But I like the tracking better than clicking.
Now if I could apply that to CEdit I'll be a happy camper.
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: same problem. Even on a dialog box?
"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
|
|
|
|
|
David,
I am bad in multitasking, so I am trying to keep the CEdit problem separate.
I have not tried to implement your tracking method on the CEdit.
I got too many fires going same time. I'll keep you posted on this one.
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: And it does it only on first "COM1:" and last "COM5:" lines. The "COM2:" thru "COM4:" it works on the entire text. That is just bizarre!
If it was not for that piece of information, I was going to suggest it might have something to do with the width of the column set really narrow and the rest of the text for some reason being written outside of the column - I believe I have seen something like that before, but what you describe here is just weird.
Sorten Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
I just put over 30 random characters in the item column and the problem is really on the first and last line. ONLY when the mouse is over the first character in the field it will get selected.
I give up.
Cheers
Vaclav
|
|
|
|
|
Here is a crazy update.
Now I cannot even select by "howering " over the first letter! But I can change / edit the item by moving the mouse to the left until I get "regular" focus. I deffinetly have an issue with my VC 6.0.
Case closed.
|
|
|
|
|
Question has been solved
Thanks everyone for those comments it helped me a lot, I am considering users here asthe most amazing users ever!
oky I have a list view (using MDI also) and I am drawing everything from scratch, everything works amazingly, but recently when i tried to print tons of data, i the list went crazy, and it seems the whole app went crazy not just the listview, I tried to disable all the features in my app and that bug still there
basically the program has a highlight row and that row in blue, that bug changes it to another color, and i cannot use the editing text method and when I minimize the list, it does not come back, as if the whole program got busted?
bty, its not form custom draw cuz i did check every single line...
http://oi43.tinypic.com/25zibrl.jpg[^]
what made it weird that even the menu went black? i am sure that if it a listview problem it wont change the menu color?? is the listview has a specific stack size or heap size in onwerdata? i dunno what i am saying but the list works fine in some cases except when i deal with more data,
any ideas why that happens?
edit1:
I tried update the whole list with the whole program and nothing happened (if it paints issues redrawing the whole app will help but did not work here?)
edit2:
some has almost same problem and he wrote (I am using a CListView in my application. When I run the application and it gets a lot of items in it's CListView (3 or 4 thousand at least) the application's windows go all stange. From then after all Menus in all applications (including taskbar and desktop menus) are displayed with black bars over most of their items, moving the mouse down over them removes most of the black bars.
Thanks for any help.)
but no one answered him?
modified 21-Aug-13 17:27pm.
|
|
|
|
|
Hi,
I'm not certain if this is the problem but you say that the problem started when you wanted to show a lots of data, you also mentioned that you draw the list yourself. (Custom draw)
It could be that you are running out of resources, GDI resources to be precises, this could explain why even other part of the application are getting problems drawing themselfes.
Its a wild guess, but its worth to check this. (this can be verified quickly with the task manager)
regards
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
i did not even think about that?!!! the thing is as soon as my program rich 10000 objects then that bug appears so, and if i am not wrong i remember that win7 it's 10000 as default so, by increasing that it will fix it 100%, which can be done from the registry
thanks I really appreciate that, and i do like this site better than stackoverflow, since they think that they are the best and as soon as you ask question they consider you as a jerk (down vote)
anyway thanks a lot....
|
|
|
|