|
Ppl started posting their question papers!
|
|
|
|
|
I found a free ANSI C parser with source code - Gold Parser[^]. You could download the source as well. You can look at the source and tune it for a preprocessor and generate the .i file. I hope it will be useful for you.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi All,
I am porting a VC++ 6.0 to VC++ 9.0
I am getting the LNK error when i tried to pass a iterator as a function parameter.
Here is the code.
void CMemTable::TestIterator( std::list< CString >::iterator it)
{
std::list< CString >::iterator itLocal;
itLocal = it;
}
CMemTable pTable;
std::list<cstring>::iterator test;
pTable->TestIterator(test);
error LNK2019: unresolved external symbol "public: void __thiscall CMemTable::TestIterator(class std::list<class>>,class std::allocator<class>>>::_Iterator<1>)"
All suggestions are invited.
Thanks you.
|
|
|
|
|
The coded you've posted wouldn't compile - pTable is an object, but you're calling TestIterator using 'pointer to member' syntax.
I'm wondering - does the signature of the declaration of TestIterator (in the CMemTable class declaration) exactly match the signature of the method's definition?
|
|
|
|
|
pratap1980 wrote:
pTable->TestIterator(test);
In other words, make it pTable.TestIterator(test);
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Here is my problem:
I want access to the CPropertySheet parent window so that when I define a list control dynamically in one of its property pages, that list control (and its movement) is tied to the parent CPropertySheet.
I want to do this so that I can "share" one CListCtrl between 2 or 3 property pages.
Here is what I have:
CMyPropSheet
CSettingsPage2 *m_pPage2;
m_pPage2 = new CSettingsPage2;
AddPage ( m_pPage2 );
property page
CSettingsPage2::CSettingsPage2()
: CPropertyPage(CSettingsPage2::IDD)
{
}
void CSettingsPage2::DefineList()
{
g_MyCListCtrl.Create ( dwStyles, rLocRelative2Page, pPropSheet, IDD_SOME_CONSTANT );
}
The one CListCtrl lists items that must appear in 3 property pages - each of the 3 pages will reveal different attributes of the list's items. I know design could be different to accomplish the same, but I want it this way.
Thank you very much!
John John
|
|
|
|
|
Not sure that you can do that - each different property page is a different dialog template, so has different controls.
The easiest way is just to have a separate list control on each page that contains the same items? If the three pages all have a reference to the same (externally contained) set of data, that's much easier than messing around trying to get the same list control on each page.
Alternatively...(and this is something I was discussing with one of my developers today) you could just have one dialog, with a tab control on it. When you select different tabs, you show/hide controls to match the activated tab.
|
|
|
|
|
Why can't you pass the CPropertySheet pointer to CSettingsPage2's constructor and keep it as a member variable? for instance,
CSettingsPage2::CSettingsPage2( CPropertySheet* pPropertySheet )
: CPropertyPage(CSettingsPage2::IDD),
m_pPropertySheet( pPropertySheet )
{
}
While creating the property page,
m_pPage2 = new CSettingsPage2( this );
AddPage ( m_pPage2 );
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
I am trying this right now, but I am not sure of what I need to account for.
is the Constructor simply:
CSettingsPage2::CSettingsPage2( CWnd* pParent )
: CPropertyPage(CSettingsPage2::IDD)
{
m_pParentWnd = pParent;
}
Then when I create each page
m_pPage2 = new CSettingsPage2( this );
What I am also thinking I need to consider is when I move the entire property sheet window. Since my CListCtrl was tied to the parent property sheet, would my g_MyCListCtrl move just as it would have if separate instaces were created on each page and tied to those pages?
Also, what would the Z-order be of g_MyClistCtrl with respect to other pages (don't want it hidden when it should be active in Page2 (and elsewhere).
Thanks for the input.
|
|
|
|
|
john john mackey wrote: // DO I NEED TO DO SOMETHING FOR CSettingsPage2::IDD ABOVE ???
You're implementation seems to be fine. You don't need to do anything extra to access your CPropertySheet.
john john mackey wrote:
What I am also thinking I need to consider is when I move the entire property sheet window. Since my CListCtrl was tied to the parent property sheet, would my g_MyCListCtrl move just as it would have if separate instaces were created on each page and tied to those pages?
Also, what would the Z-order be of g_MyClistCtrl with respect to other pages (don't want it hidden when it should be active in Page2 (and elsewhere).
Well, may i ask you why do you want to share the same list control between PropertySheets? The list control contain some common data that have to be displayed in all property sheets? or are you just trying to reuse the instance of list control itself? I'm sorry that i'm not really getting why you want to share the list ctrl between windows.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
When I tried this implementation of passing the CPropertySheet via the constructor, it compiles ok, but the control is not visible at runtime.
Constructor
CSettingsPage2::CSettingsPage2( CWnd* pParent )
: CPropertyPage(CSettingsPage2::IDD)
{
m_pParentWnd = pParent;
}
Instantiate the page and add it
m_pPage2 = new CSettingsPage2( this );
AddPage ( m_pPage2 );
Called on Page2's OnInitDialog
void CSettingsPage2::DefineList()
{
g_MyCListCtrl.Create ( WS_VISIBLE | WS_CHILD, rLocRelative2Page, m_pParentWnd, IDD_SOME_CONSTANT );
}
Page2's property page/tab appears ok, it's just that I can't see g_MyCListCtrl anywhere - even looked for the control using Spy++.
Is it an issue of page2's coordinates relative to CPropertySheet? Is it buried under all the property pages that CPropertySheet manages?
I'm stumped
|
|
|
|
|
Check whether the g_MyCListCtrl.Create() is success or not. Well, if its success, then the problem might be in the co-ordinates that you've specified.
Well, i suspect that most probably the control will be hidden under your property pages. My suggestion is to create the list control as child of the first visible PropertyPage. Then when your other property page became active, i.e. in CPropertyPage::OnSetActive() , call g_MyCListCtrl.SetParent() and set the current property page as new parent. Well, just try whether its possible.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks! you've been helpful and patient. I will try your suggestions.
Here is what I am doing wrong:
1) in the instantiation of the page, I forgot
m_pPage2 = new CSettingsPage2( this ); // pass the CPropertySheet pointer
2) I am testing the constructor of CSettingsPage2 to make sure I get a valid CWnd * for the CPropertySheet
3) I am also testing at the point of the list creation if m_pParentWnd is valid
So far, I get a runtime crash when included 1).
Thank you for the help. I guess it's now one of those Left to Student issues to resolve my problem.
|
|
|
|
|
okay. Just try. Well, if you need more help just ping back and wish you good luck!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
It worked! The problem I was getting was in my "own" Create function - I needed to initialize a couple of "its own" member variables.
So I passed in the parent window pointer (CPropertySheet), created my CListCtrl and tying the parent window back to the property sheet itself - it worked, sort of!
When I tied it directly to the property sheet, the CListCtrl got tangled up in the tabs of the current page and other tabs - i didn't have control over it and moving it didnt help.
So I tried what you suggested, I used SetParent() to change the parent of the dynamic CListCtrl to the current page. It worked great and just how I wanted it - moving the entire dialog had no side effects, I had full control of my CListCtrl.
Thanks so much! Now if someone asks me how, I know how to guide them too - whoo hoo!
John John
|
|
|
|
|
john john mackey wrote: It worked great and just how I wanted it - moving the entire dialog had no side effects, I had full control of my CListCtrl.
Wow!!! Great!
john john mackey wrote: Thanks so much! Now if someone asks me how, I know how to guide them too - whoo hoo!
I'm so glad to hear those kind words!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi,
How to get the enclosing rectangle for a circle?
|
|
|
|
|
by reusing the center point and the diameter
|
|
|
|
|
what do u mean by that ? can u give me an example or post links to tutorials
Basically im following a book in which we are developing a sketcher application so for that I need to get the enclosing rectangle for circle then with which I will draw the circle by getting the points from the mouse message handlers and providing it to the function which draws circles
NOTE: this is not an exercise, the book explains how to do that but im unable to understand it. I also have the code how to do it, but i wanna understand it. so I'm not cheating thx.
modified on Friday, December 12, 2008 10:37 AM
|
|
|
|
|
manzoor10 wrote: the book explains how to do that but im unable to understand it
Try harder.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
It seems like you need to get rectangular coordinates that are used draw the circle using corresponding API.
If so, you need to get the first point (left,top) when the mouse button is down and get the last point (bottom, right) when the mouse button is released. Have a look at WM_LBUTTONDOWN and WM_LBUTTONUP messages, and if needed, WM_MOUSEMOVE... You can map them to OnLButtonDown, OnLButtonUp, etc., if you are using MFC.
I believe there will be sample codes in CP itself ( I didn't search yet... )
|
|
|
|
|
Oh, for the love of god! This makes finger-painting look like a fine-art.....
int radius;
POINT circleCenter;
RECT boundingRect;
boundingRect.left = circleCenter.x - radius;
boundingRect.top = circleCenter.y - radius;
boundingRect.right = circleCenter.x + radius;
boundingRect.bottom = circleCenter.y + radius;
|
|
|
|
|
manzoor10 wrote: enclosing rectangle for a circle
Actually it is a square (well, I know the square inherits from the rectangle ).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: well, I know the square inherits from the rectangle
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Hi, I could not add a new .rc file to visual studio 2008 express edition, so I created a text .rc file and then added it using add existing item. That part worked okay. The resource folder now shows in visual studio 2008. BUT when I try to add files to the folder it tells me that the express version of the visual studio does not support resource file editing. Please help. How do I edit the resource file? Is there a way that I can create the resource script and it's files outside of the IDE? Please help!
|
|
|
|