|
I think you need to set the scroll size. Try this function:
SetScrollSizes()
|
|
|
|
|
Thank you Lucy, i tried your suggestion, i did like:
CRect myRect;
CSize mySiz e;
this->GetClientRect(&myRect);
mySize=myRect.Size();
for (int i=0;i<100;i++)
{
caramba[i] = new CStatic;
g.Format("%d", i);
caramba[i]->Create(g, WS_CHILD|WS_VISIBLE|SS_CENTER|WS_BORDER, CRect(10, i*10, 120, i*10+50), this);
myRect.bottom+=20;
}
MoveWindow(myRect.left, myRect.top, myRect.right, myRect.bottom);
this->GetParentFrame()->RecalcLayout();
this->SetScrollSizes(MM_TEXT, mySize);
this->ShowScrollBar(SB_VERT, TRUE);
this->SetScaleToFitSize(mySize);
Even using SetScrollSizes and ShowScroll after RecalcLayout, it apears for half a second or something, and then disapears again.
I tried SetScaleToFitSize and it did not improve
Why does this appends?
Thank you in advance
|
|
|
|
|
I am not sure. But I think you need to give the total size to SetScrollSize. that is, the size of your document.
Excuse me for my poor English, let me give you an example.
Say you are opening a document which will occupy a 800x600 screen. But your window is only 400x200 big. So you set the scroll size to be 800x200. And the vertical scroll bar and horizontal scroll bar will appear for your to scroll to see the other part of the contents.
If you are using this->GetClientRect() to set scroll size, you are telling Windows that the screen needed is of the same size as the screen allocated. So, no scroll is necessary.
Hope this helps.
|
|
|
|
|
Sure it helped, i got it working
Thank you very much Lucy, i hope i can help you when you need it
|
|
|
|
|
I want to have a cancel button for a progressbar which pops up on its own window. This is to cancel the operation. I read about peeking in the message queue etc. What I want to do when I get the ID_CANCEL message, is to terminate the process which is happening within the dll. WHats the way to do this termination? Do we notify the dll which then disposes of itself ? Or can we externally "kill" the dll?
Thanks,
ns
|
|
|
|
|
I'm not sure what you're trying to do here (multi-thread?) but you can always unload a dll with the same handler you received loading it.
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
No, its single threaded. except that my dll does a lengthy process, and I am trying to avoid the hassle of notifying it that a CANCEL was received (Its a VB dll) So I was thinking that I could kill it from outside> but I guess it has complete control till it finishes, so I'll have to send it a message to interrupt it. Not fun since the dll is in VB and the sender is VC app. VB cant take user defined messages...
Thanks,
ns
|
|
|
|
|
There's no difference between .dll and non-dll code in respect to your problem. You just need kind of a communication channel between the time-consuming process in .dll and part implemented in .exe. Sort of callback, perhaps.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
I'll work on it...
Thanks,
ns
|
|
|
|
|
Hi,
I have used the following to print out my text & tabs, it has worked fine!
<br />
dc.DrawText(Text, CRect(x, y, x + Info.m_rectDraw.Width(), y + csText.cy), DT_EXPANDTABS) ;<br />
*)But because I need some special spacing (in-line) ... I would like to reset the Default TabStop from 8 charcaters down to 7! I try the follwing but it does not work! (set high order byte in nFormat = 7)
<br />
dc.DrawText(Text, CRect(x, y, x + Info.m_rectDraw.Width(), y + csText.cy), (0x0700 |DT_EXPANDTABS)) <br />
or
<br />
dc.DrawText(Text, CRect(x, y, x + Info.m_rectDraw.Width(), y + csText.cy), (0x0700 | DT_TABSTOP));<br />
Anyone knows why or how to do it?
Many thanks for any help!
|
|
|
|
|
Use TabbedTextOut(), you can specify the tab size.
_____________________
"So in the interests of survival, they trained themselves to be agreeing machines instead of thinking machines. All their minds had to do was to discover what other people were thinking, and then they thought that, too."
Breakfast of Champions, Kurt Vonnegut
|
|
|
|
|
Hi Daniel,
I will try your suggesttion,
Thanks for help,
Anh
|
|
|
|
|
Use DrawTextEx. You'll be able to pass tab size in DRAWTEXTPARAMS struct (iTabLength field).
BTW: where did you get this (0x0700 | DT_EXPANDTABS) stuff?
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Hi Tomasz,
Thanks and I will try ... but I do not think it is easy for me to do your suggestion (I am not very good in DrawText commands) ... might be you can help a bit more detail?
*) The (0x0700 | DT_EXPANDTABS) I did, because I read in CDC:DrawText command specificatons:
===========================================================================
int DrawText( const CString& str, LPRECT lpRect, UINT nFormat );
nFormat:
Specifies the method of formatting the text. It can be any combination of the following values (combine using the bitwise OR operator):
DT_TABSTOP: Sets tab stops. The high-order byte of nFormat is the number of characters for each tab. The default number of characters per tab is eight.
DT_EXPANDTABS: Expands tab characters. The default number of characters per tab is eight.
===========================================================================
I only guess and do it (both) & does not work ... might be you know how to do it right?
Many thanks,
Anh
|
|
|
|
|
I've checked the MSDN, and it says that you should use bits 8-15 for # of tab stops. So the nFormat should look more or less like this:
[edit - of course it's 0x700]
0x700 | DT_TABSTOP | DT_EXPANDTABS
Give it a try. If it doesn't work, try with DrawTextEx.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Hi Tomasz,
I did as you suggested and it works beautifully! Thank for helps & very fast solutions!
Many thanks,
Anh
|
|
|
|
|
Hi,
I have inserted an ActiveX MSChart control onto my PropertyPage. I set the properties to xy scatter and am trying to display a simple non linear line graph for y = x*x
How can I do this in a message handler?
Do all the classes need to be registered when i add the activex control as there are quite a few?
I'm also looking for documentation regarding chart control.
Cheers
kash
|
|
|
|
|
|
created this sample application to reproduce the modal dialogs problem:
- Created SDI application
- Added derived from CPropertySheet, CPropertyPage and CDialog classes
- Created CPropertySheet in 2 steps, using constructor and Create, where I passed NULL as parent, which actually is a DeskTopWnd. Added MyPropertyPage with button to run MyModalDialog.
- To reproduce it - from File menu -> New - run MyPropertySheet, then run MyModalDialog, the first one, again go to New and open another sheet, run second modal dialog from it.
- The problem is: if you go back to first modal dialog and click OK to close it - it will be closed but really won't return from DoModal() modal loop and stay waiting in the CWnd::RunModalLoop() till the second modal dialog would be processed. After processing the second modal dialog the CWnd::RunModalLoop continues for the first one, successfully exiting and returning DoModal() of the dialog which has been already closed and destroyed.
If somebody had this issue before, please help!
|
|
|
|
|
Na russkom mogeh scazat' problemu?
|
|
|
|
|
In case if you didn't recieve my email... pasting it here:
Zdravstvui, spasibo za bistii otvet!
konechno mogu u dazhe predostavlui moi primer...
Cozdala SDI, dobavila classes derived ot CPropertySheet, CDialog u CPropertyPage... MyPropertySheet sozdau dynamically na File,new v dva etapa:
snachala constructor, standard, potom dynamically MyPropertyPage, AddPage(), potom pMyPropertySheet->Create(NULL), NULL znachit the Parent window budet DeskTopWnd. Microsoft pozvolyaet eto delat' 8) dazhe v SDI... Takim obrazom esli zapuskat' s takix property sheets modal dialogs - oni poluchautsya modal'nie tol'ko dlya parent, t.e. MyPropertySheet! eto pozvolyaet prodolzat' rabotat' so vsei application normal'no. Problema pri zakritii - t.k. elsi ih zakrivat' v poryadke otkritiya (ot bolee rannego k bolee posdnemy) DoModal ne rabotaet! na (DoModal == OK) naprimer ti mozhesh uvidet' ti ne popadaesh v breakpoint. U nas project starii i ochen' razroshiisya i menyat' modal'nie dialogs to modeless would be headache... delat' threads dlya kazhdogo modal dialog eche bol'she headache... Vot takaya problema... Esli hochesh posmotret' v deistvii - attachment prilozhen. Spasibo ogromnoe. Nadeus' uslishat'...
|
|
|
|
|
Is it possible to assign multiple images to a tree item in a CTreeCtrl? Basically, I'd like to have more images than the two that are possible now.
If not, is it possible to assign images instead of text? I don't know that I need code snippets (although they'd be appreciated). Just some clues as to what I need to do.
|
|
|
|
|
Rob_PSU wrote:
Just some clues as to what I need to do.
Clue: use NM_CUSTOMDRAW.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
That's what I was afraid of.
Thanks!
|
|
|
|
|
My code like this:
CUIntArray CMyClass::CMyFunc(CUIntArray caArrayA,
CUIntArray caArrayB)
{
return m_ncaBinaryResult;
}
CMyClass derived from CObject. CUintArray is almost same as CArray, but only contain UINT elements.
I got "class 'CUIntArray' : no copy constructor available" compile error at the 'return m_ncaBinaryResult'. How to fix it. Thanks.
mIchAel Liu
__________________________________________________________
The secret of business is to know something that nobody else knows.
|
|
|
|