|
I have a document with CEditView that I want to limit to 80 characters. i was thinking of adding a check where I update the row/column counter. However I'm not sure how I can insert a "\r\n" at that point in the document.
Any help? or better ways I can approach this.
Thanks a bundle.
BW
The only people for me are the mad ones, the ones who are mad to talk, mad to live, mad to be saved, desirous of everything at the same time, the ones who never yawn or say a commonplace thing, but burn, burn, burn like fabulous yellow roman candles exploding. - Jack Kerouac
|
|
|
|
|
ummmmm dont u just trap the OnChange() event or the OnKeyUp() event and inc a counter?
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" biz stuff about me
|
|
|
|
|
How can I get a pointer to my CDocument class in the CMainFrame class?
I have a Document / View application and have to work with some data of the document in my CMainFrame class.
So, how can I get a pointer to my document?
Is there any AfxGet??? function?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
I believe this is it.
CFrameWnd::GetActiveDocument()
MD
Mark Donkers
A witty saying proves nothing.
-- Voltaire
|
|
|
|
|
Thanks!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
We have a software development project which includes 74 PC's with in it a PlexWriter 24/10/40A.
Our program has to be able to write to CDR. Due to other reasons we cannot use Packet writing. Is there a programmers Interface (API) to a CDR/CDRW ?
OS: Windows 2000/SP2
Dev: MSVC C++ 6 SP4/MFC
|
|
|
|
|
I know your OS is Windows 2000/SP2, but if you can afford a Windows XP upgrade, you can use IMAPI, a high-level API for CDR/CDRW writing. And it will work on whichever writer/interface Windows can recognise.
Q261186 - Computer Randomly Plays Classical Music
|
|
|
|
|
general.failure wrote:
Is there a programmers Interface (API) to a CDR/CDRW ?
No, but there are free source available to do what you want. Google for e.g. CDRecord.
|
|
|
|
|
Hi,
i am trying to disable the horizontal scroll bar in list ctrl. the scroll doesn't appear until i add a lot of items in the list (it appears because the vertical scroll bar appears as well).
here is the code i use
void CMyListCtrl::OnStyleChanging(int nStyleType,LPSTYLESTRUCT lpStyleStruct)
{
if (nStyleType != GWL_STYLE)
{
CListCtrl::OnStyleChanging(nStyleType,lpStyleStr
uct);
return;
}
lpStyleStruct->styleNew &= ~WS_HSCROLL;
SetWindowLong(m_hWnd,GWL_STYLE,lpStyleStruct->styleNew);
}
this indeed change the style of the list not to have WS_HSCROLL bar, but the scroll bar is still shown....
please help me
i am really desperate, this is the 4th post i am asking for help
thanks
Yaron
Ask not what the application can do for you, ask what you can do for your application
|
|
|
|
|
Are you trying to remove the scrollbar so it doesn't even appear when normally it would, or are you just trying to disable it so that it's shown but the user can't scroll with it?
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
I am trying to to remove the horizontal bar so it won't ever appear....
can u help?
thanks
Ask not what the application can do for you, ask what you can do for your application
|
|
|
|
|
Unfortunately, there is no easy answer. Scrollbars in CListCtrl are drawn and handled internally by the list control, and aren't actually controls by themselves. Thus the only way to disable them is to derive from CListCtrl and write your own drawing routine... not a very fun thing to do.
What's the cause of the scroll bar appearing in the first place? If you're trying to forcefully remove it, have you looked at fixing what causes it to appear?
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
I had the same issue. What I ended by doing is resizing the columns when the vertical scroll is added. So instead of hardcoding the width of column, you assign it a percentage of the listctrl's width. Then call this function whenever your listctrl needs a vertical slider. The user can still resize the column with the header control (which could cause a horizontal scrollbar to appear).
void CMyDialogDlg::ResizeColumns(const int iPercentageOfListCtrl)
{
CRect rect;
m_cListCtrl.GetClientRect(rect);
int iNewWidth = (rect.right * iPercentageOfListCtrl / 100);
int iOldWidth = m_cListCtrl.GetColumnWidth(0);
if (iOldWidth != iNewWidth) {
m_cListCtrl.SetColumnWidth(0, iNewWidth);
}
}
This will resize the first column enough so that the list ctrl doesn't think it needs a horizontal scroll bar.
Hope this helps.
|
|
|
|
|
Hi,
thanks for reply.
when should i call this function, shall i call it
when OnSize() occurs???
Yaron
Ask not what the application can do for you, ask what you can do for your application
|
|
|
|
|
i need help for creating additional button on windows's caption area (near minimize,maximize,close)
for example, help, minimize to tray ... etc...
also i mean - to create many buttons (not one )
somebody can explain, or just give some URLs where i can find out this examples ..
PS : google doesn't help... and i can not find out it here ..
PPS: sory for my ENG;
----------------------------
never stop coding.
|
|
|
|
|
Hi,
Try this : http://freespace.virgin.net/james.brown7/tutorials/titlebar.htm
Florian Szoke
|
|
|
|
|
hi
i need a help in printing. in my project my window certain area i like to print not the entire client area. how can i print the data containing in the particular area on the window to printer.
thanks alot
from
venu
|
|
|
|
|
well presumably the user can select an area of the view to print somehow ... when they select print u would figure out what part of the data they have selected in ur document and send that to the printer
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" biz stuff about me
|
|
|
|
|
Hello everyone,
Wow. It's been a while since I've been here. I was doing some embedded stuff there for a while. It's nice to be back.
Anyway, the question that I had has to do with having the ability to cancel a process that is in the middle of a for() loop. What I would like is a dialog that pops up on the over the application window that simply says "Cancel". I was reading used the code from Nishant's article Tutorial - Modeless Dialogs with MFC (http://www.codeproject.com/dialog/gettingmodeless.asp#xx211427xx). I've declared my modeless dialog as a local variable in the function with the loop. In the loop I want to check to see if the Cancel button was pressed. When I enter my loop, I can't press the Cancel button. Any ideas?? Thanks in advance.
LONG CTest3431::TestKeypad()<br />
{<br />
LONG lRetVal = 0;<br />
CCancelDlg dlgCancel;<br />
<br />
dlgCancel.SetProgressText("Running keypad test...");<br />
dlgCancel.ShowWindow(SW_SHOW);<br />
....<br />
<br />
for( i=0; i<sizeof(sbKeys); i++ )<br />
{<br />
if( dlgCancel.IsOperationCancelled() )<br />
{<br />
lRetVal = -1;<br />
break;<br />
}<br />
<br />
....<br />
}<br />
<br />
Mark Donkers
A witty saying proves nothing.
-- Voltaire
|
|
|
|
|
|
That did the trick. Thanks Ravi!
MD
Mark Donkers
A witty saying proves nothing.
-- Voltaire
|
|
|
|
|
hi
i need a help in printing. in my project my window certain area i like to print not the entire client area. how can i print the data containing in the particular area on the window to printer.
thanks alot
from
venu
|
|
|
|
|
Hi guys.
I have the following question?
I know that the WM_CHAR message goes to the main window of the program but isn't it Main Frame?Yeah,yeah ... i see that this is CView but where exactly this is coded in MFC?
And if I try to "go round" Doc/View and do something like
m_pMainWnd = new CMainFrame
m_pMainWnd->ShowWindow(..)
m_PMainWnd->UpdateWindow()
who gets WM_CHAR ?
and yes .. .I'm a newbie
10x in advance
|
|
|
|
|
OK. I made a template class that is like a circular buffer but then that could take many diffferent types of variables for a 2-D type graph.
Now, I want to use declare a pointer to this in another class BUT that does not know what kind of variables it will be before hand. Is this possible? After this, when I declare the graph class lets say, I want to tell it what kind of variables the circ buffer will be. This way, it can use the variable types and how I tell it to plot or do some manuipulation.
I am not sure how even to do this. Any ideas would be greatly appreciated.
Thanks
|
|
|
|
|
This can be done, but it is no trivial task. I'll sketch a basic scheme for a very simple data structure having only two member functions called put and get . As the host class (the one using the data structure) does not know in compile-time the exact type of the structure, this has to derive from an abstract base:
struct datastruct_base
{
virtual ~datastruct_base()=0{}
virtual void put(const void* arg)=0;
virtual void get(void* arg)=0;
}; Note the argument to the functions has to be declared as raw pointers to void , since datastruct_base does not know about the actual types handled by its derived classes. A better approach could be taken using some sort of polymorphic variable like the one featured in Boost.Any[^].
Now, template classes derive from this abstract base like this:
template<typename type>
struct datastruct: public datastruct_base
{
virtual void put(const void* arg)
{
put(static_cast<const type*>(arg));
}
virtual void get(void* arg)
{
get(static_cast<type*>(arg));
}
void put(const type* arg)
{
...
}
void get(type* arg)
{
...
}
}; That's it. The host class sees the passed data structure through its base virtual class. For each instantiation of datastruct , put and get forward to non-virtual , type-specific member functions:
class host{
private:
datastruct_base* ds;
public:
void set_datastruct(datastruct_base* ds){this->ds=ds;}
void put(const void* arg){ds->put(arg);}
void get(void* arg){ds->get(arg);}
};
host hs;
datastruct<int> dsi;
hs.set(&dsi);
int i=10;
hs.put(&i);
hs.get(&i); Hope you get the idea. This is a common idiom in modern C++, with roots stemming from a relatively old technique called envelope-letter. Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|