|
I want to use the CRectTracker for tracking objects and the the CScrollView for scrolling the Document, but , every time I scroll the current tracked object out of sight and in again the tracker is not redrawn, anyone suggestions ?
|
|
|
|
|
I have several CListCtrl which display over 50000 items. So i created my own CListCtrl with LVS_OWNERDATA so i can handle the memory myself. It works fine except for one simple thing...
the MFC CListCtrl posts a message if an SetItemText is called on an item which is selected. I added
<br />
int CMyListCtrl::SetItemText(int iItem, int iSubItem, LPCSTR txt) {<br />
...<br />
NM_LISTVIEW nmlv;<br />
nmlv.hdr.hwndFrom = m_hWnd;<br />
nmlv.hdr.code = LVN_ITEMCHANGED;<br />
<br />
nmlv.iItem = iItem;<br />
nmlv.iSubItem = iSubItem;<br />
SendMessage(this->m_hWnd, LVN_ITEMCHANGED, 0, (LPARAM)&nmlv)<br />
return iItem;<br />
}<br />
to my costum SetItemText function but it doesnt work...
the item changed events are sent if i click on an item
Any Ideas?
Thanks for your help
Eibwen
|
|
|
|
|
does the forum belong to microsoft? otherwise to whom?
thx
includeh10
|
|
|
|
|
|
Can't you tell that it's part of the Linux/Unix world?. It's elementary!
Best regards,
Alexandru Savescu
|
|
|
|
|
I've recently been given the task of modularizing our main dialog class in a project at work. Currently I am creating a sub-class of CTreeCtrl called Gallery which will be used to wrap the basic functionality of our Tree control.
Here are the steps I have taken. I created CGallery as a subclass of CTreeCtrl. I used the class wizard to change the CTreeCtrl object in our main Dlg be the member variable of type CGallery called m_gallery.
Here is the problem. How can make it so that events are passed to my instance of CGallery and not to my main Dialog. I know I'm overlooking something obvious but this is my first time dealing with VC++ and I'm quite lost. Any help would be greatly appreciated.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
|
jparsons wrote:
How can make it so that events are passed to my instance of CGallery and not to my main Dialog.
You mean events like TVN_* notifications? If this is the case, you'll need to use so-called message reflection. In ClassWizard add CGallery handlers for messages marked with '='.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
I'm having trouble printing a document that is more than one page in length. ie (3 pages). It only prints the first page. What am I doing wrong.
Please Help, thanks
|
|
|
|
|
are you using the CDC::StartPage / EndPage calls?
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Yes, I'm reading the contents of a listview box inside the StartPage and EndPage.
|
|
|
|
|
are you calling StartPage at the beginning of each page?
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Do you have any code sample on what it should look like. This is very new to me.
|
|
|
|
|
the code roughly goes like this:
StartDoc
While (pages_to_do)
StartPage
PrintPage
EndPage
EndDoc
the hard part, is setting pages_to_do - it requires you to keep track of how much you've printed compared to the size of the page.
do an MSDN search on "startdoc" - there are a lot of printing articles.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Has anyone had any experience using BizTalk synchronously? We need to send a message to BizTalk and receive a reply including results of the message. Documentation in this area is very sparse as is the MS way
If you don't but know somebody that does....please send them my way!
Thanks!
ed
|
|
|
|
|
why "gethostbyname" can sometimes return WSAHOST_NOT_FOUND while the pc is connected to the internet and the destination www-site should be shurely accessible?
|
|
|
|
|
gethostbyname will not be able to retrieve the IP address of a server in Internet if you're connected to it through a HTTP proxy.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks!
Can you give any advice or link to the sample code that solves the problem?
|
|
|
|
|
Hello,
I have a calendar control that will not redraw itself until I move the application window (click on date and nothing happens, then, move window and date changes to what I clicked on). It's located on a dialog bar whoose parent is CMainFrm. If I call UpdateData(FALSE) on ANOTHER dialog bar I have (same parent), then the calendar control starts working as normal. I would like my calendar control to begin working (updating/redrawing itself) immediately. I suspect that my windows messages are not being routed correctly?
Any ideas? Thanks!
JennyP
|
|
|
|
|
What calendar control are you using. Is it a third party control or the basic run-of-the-mill control found in the Visual C++ resource toolbox?
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hello,
Thanks for the reply. I'm using the VC++ standard CMonthCalendar control. It really looks to be the entire DialogBar that is not being updated. For example, if I run the program and let it sit in its original state (no clicking on it or using the application in any way), and the screen saver turns on, when I wake-up the computer, there is a large black rectangle where the DialogBar should be.
JennyP
|
|
|
|
|
This is strange to me. Let me get a few things straight:
1. Is the calendar control on the dialog bar itself? If not, where is it?
2. Have you overriden *ANY* painting/drawing methods at all. If so, which ones and what does your code look like?
3. How did you add your dialog bar to the project?
4. Is your application an MDI or SDI?
Let me know.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
perlmunger wrote:
1. Is the calendar control on the dialog bar itself? If not, where is it?
2. Have you overriden *ANY* painting/drawing methods at all. If so, which ones and what does your code look like?
3. How did you add your dialog bar to the project?
4. Is your application an MDI or SDI?
Thanks for your reply, Matt....
4. MDI.
1. The calendar control was created with the VC++6.0 dialog editor to be part of the Dialog.
2. I did override OnCreate in the DialogBar with the following. (Sorry, I couldn't get the tabs to copy over.)
int CDiagGlobalSched::OnCreate(LPCREATESTRUCT lpCreateStruct) <br />
{<br />
if (CDialogBar::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
<br />
int i;<br />
CRect CERectHome(245, 8, 260, 25);<br />
CRect CPRect(245, 54, 260, 96);<br />
CRect CERect;<br />
DWORD BaseStyle = WS_CHILD | WS_VISIBLE;<br />
DWORD EditStyle = BaseStyle | ES_CENTER | ES_NUMBER;<br />
for (i=0;i<21;i++) {<br />
CERect = CERectHome;<br />
m_CEDayOfWeek[i].Create(EditStyle | ES_READONLY | WS_EX_STATICEDGE,<br />
CERect, this, 2000+i);<br />
CERect.OffsetRect(0, 23);<br />
m_CEDate[i].Create(EditStyle | ES_READONLY | WS_EX_STATICEDGE,<br />
CERect, this, 2100+i);<br />
CERect.OffsetRect(0, 70);<br />
m_CEAllocated[i].Create(EditStyle | WS_TABSTOP, CERect, this, 2200+i);<br />
CERect.OffsetRect(0, 23);<br />
m_CEAvailable[i].Create(EditStyle | WS_TABSTOP, CERect, this, 2300+i);<br />
<br />
m_CPProgress[i].Create(BaseStyle | PBS_SMOOTH | PBS_VERTICAL,<br />
CPRect, this, 2400+i);<br />
<br />
CPRect.OffsetRect(20, 0);<br />
CERectHome.OffsetRect(20, 0);<br />
<br />
}<br />
<br />
<br />
return 0;<br />
}
3. I used the following command in my main frame's OnCreate() function:
...
if (!m_SchedDlgBar1.Create(this, IDD_GLOBAL_DLG,
CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
{
TRACE0("Failed to create Sched dialogbar\n");
return -1;
}
m_SchedDlgBar1.UpdateData(FALSE);
...
Any further suggestions you can give would be greatly appreciated. Thanks!
JennyP
|
|
|
|
|
Some things that are done by the framework behind the scenes aren't very clear to me, however, in general I don't mess with the mechanisms Microsoft has set up to make your application development quicker. That being said, sometimes you have to do things yourself.
I'm not sure that you're really helping yourself by creating the controls manually. I've never done it this way, so I'm no expert on it. When I need an index of my controls, I just create an array with all of their resource IDs in it and iterate through that with GetDlgItem. While this is probably not your problem, I do wonder if there is something about adding a control (CEdit in your case) with the create method to a DialogBar. DialogBars inherit from CControlBar (which inherits from CWnd) rather than CDialog. While adding to a CWnd is acceptable, it is normally a CDialog where this would be done. Again, this may have nothing to do with your problem. Just food for thought, I suppose.
What I usually do when I want to add a dialog bar to my application is I use the Project | Add to Project | Componenets and Controls menu in Visual Studio. In the ensuing dialog box, open the "Visual C++ Components" folder and select the "Dialog Bar" component. Click Insert and then OK on the Dialog Bar creation dialog. This will automatically insert a new resource into the dialog resources. Just open the resource and drag and drop your componenets as needed just as in a normal dialog. It will work as expected out of the box because it was implemented within the framework.
So, where does this leave you? To be honest, I'm not sure exactly. It kind of depends on you. I will send you a demo project I created that does just this and you can view the code there. However, the components added to the dialog are done through the resource editor and not manually.
If I were you, I would backtrack until you can get it to update/repaint properly. A control should rarely need you to update the drawing for it, so your UpdateData(FALSE) method should never need to be called. Just remove controls until you see it update properly and then add them back in testing to see if they work as you go.
Best of luck to you and I hope that this had been helpful. Maybe someone who knows more about creating the controls manually could be more help to you. Let me know if you have other questions. I'd be glad to help you muddle through it any way I can .
Best Regards.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi Matt,
With your help, I was able to solve the issue. It turns out that my VC++ wizard put in "AFX_IDW_DIALOGBAR" to both of my dialog bars' nID fields (in the Create() method). I used your suggestion to roll my own nID's (in resource.h) and it worked.
In addition, I was able to remove UpdateData() from MainFrm.cpp which was really a cludge because my first dialog bar kept crashing the program if I didn't click on the document before the dialog bar. This was probably because the dialog bar wasn't properly initialized as in the first paragraph.
If you could offer some ideas of why VC++ put in AFX_IDW_DIALOGBAR instead of a new one, I'd appreciate it... Is this something I should do for all such items? Also, if I update resource.h manually, will the VC++ wizard try to use the same integer if I create a new resource later?
Finally, I'm manually creating (with no help from the dialog wizard) some edit controls because I'm wanting to draw them in a grid pattern on the dialog bar, and the dialog wizard just doesn't seem to get them exactly spaced equally (even using its space-even command).
Thanks for your help!
JennyP
|
|
|
|