|
Thanks for the info. You say that LVSCW_AUTOSIZE only allows for the width of the visible items, I'm not sure I understand cleary.
1. The header items only?
2. Those which are in view due to scroll limits?
I will play around with it when I get home, thanks again.
|
|
|
|
|
i'm not sure if it got you right but i guess
number 2 is what i meant
i'll try again with more details:
my column contains numbers from 1 to 4000.
when the current view is at the very top you can
only see numbers with one or tow digits.
applying LVSCW_AUTOSIZE now sets the
size to two digits not four since the big number
are out of view and ignored.
maybe i should mention my column header
has "#" as title so it is even shorter than
the numbers. i'm not sure what happens if the
header text is longer than all the row text.
i'm using the control in virtual/getdispinfo mode
maybe that's also playing in here!?
btw i had trouble with two-digit numbers shown
as "1..." so the current text width code is
const int iWidth = res ? ( int )( size.cx * ( _iDigits + 0.25f ) ) : 120;
i hope i put it clearly. i'm not a native speaker.
best regards, sebastian
-------------------------------------------
My website: http://www.hartwork.org
|
|
|
|
|
Thanks Sebastian, you have answered my questions clearly and with precission, very much appreciated
|
|
|
|
|
Hi,
I am after a quick fix.
I have dynamically created a CComboBox control.
It works fine, but the drop down part does not seem to draw.
I cannot see any obvious calls to adjust the height of the dropdown
Cheers
|
|
|
|
|
A quick guess - you actually create a combobox with its full dropped down height on
creation. It will self correct the height to one row of text, but remember the original
height.
Iain.
|
|
|
|
|
Cheers Iain just the trick!!
|
|
|
|
|
i have a sdi application and i want to draw a dynamic array that is present in CMainframe. problem is that the onDraw function is present in the view class.
i have tried getting the active view in the cmainframe but if i work with it, application throws exception or something.
please help me, as to how i can draw the variables(contents of the dynamic array) present in the mainframe, on screen.
thankyou
|
|
|
|
|
Why don't you want to draw it on your view ? The view is there for that reason, the mainframe is just the 'window' that will contain your view.
I think you need to review a little bit your program architecture. First, in a SDI application, all data should be contained in your document, not in your mainframe. Then, when the view is painted, it ask for data to the document and it draws this data. Normally, that is the standard way to proceed.
|
|
|
|
|
ok, I kinda know the answer, but maybe I overlooked something.
I have a C linked list collection ( old legacy C code that I don't want to change ).
The new items are added at the beginning of the list.
If I want to pass this pointer around to different classes :
class MainClass
{
MyList* pList;
};
class MyOtherClass
{
MyList* pList;
};
....
MainClass mainClass;
...
MyOtherClass otherClass;
otherClass.pList = mainClass.List;
now, if I add items to the list in MainClass , the other pointer in MyOtherClass will not point to the good item; it will point to the item that MainClass.pList was pointing at the time it was assigned.
is there an easy way to have the pointer pList in MyOtherClass always point to the same thing that the pointer pList in MainClass ?
One way to fix this would be to insert at the end; that will keep the head of the MainClass list.
One other way could be do something like : ( this seems to work in the small test I did )
class MyOtherClass
{
MyList** pList;
};
MyOtherClass.pList = &mainClass.pList;
but I can't do it in my application; the list belongs to a another class, and that implicate a lot of other problems.
Any other ideas ?
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
MyList is the calss that manages the linked list right ? So, on of the member in it should be the head of your list.
When you store the address of this class in another pointer, they will both point to the same linked list object. Thus, if the head changes, it will change for both pointers as they both point to the same class.
Or maybe I misunderstood your question. Maybe show us the code for the MyList class, it will help.
|
|
|
|
|
Actually, after reading your reply, I now believe that YOU understood him and I did not. Shame on me
Cedric is right: Just make the list-head accessible from your List-Class. If you need the most recent element, have your List-Class store a pointer to it as well.
Anyway, the List-Class should manage access to its contents, not the containing classes.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
no, sorry, my mistake, MyList ( maybe the wrong name here ) is the head of a link list; not the container of the list itself.
class MyList
{
MyList* pNext;
}
so, in standard ( beurk ) C ...
MyList* pList = NULL;
MyList* p = new MyList;
p->next = NULL;
pList = p;
p = new MyList;
p->next = pList;
pList = p;
...
on solution that we found was to keep a reference to the list in the MyOtherClass class.
class MyOtherClass
{
MyList*& pList;
};
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
If you invalidate the pointer in your main class, you will have to update it in the other class.
One other thing you could try: Have a function "getCurrentPointer" or whatever you want to call it, and store a MainClass* myMainClass in your "OtherClass". Then use "myMainClass->getCurrentPointer" to retrieve the actual object.
e.g. (c-like pseudocode):
class MainClass
{
private List myList
public List* getCurrentList()
}
class OtherClass
{
private MainClass* pMainClass
public void setMainClass(*MainClass)
}
and somewhere:
OtherClass myOtherClass
MainClass myMainClass
OtherClass.setMainClass(&myMainClass)
// Now, when you change your List, you always use
myOtherClass.pMainClass->getCurrentList()
Since you are not pointing to a data member of a MainClass object, but to the object itself, you can do about everything you want with the MainClass-List (except deleting it, of course) and still have a way to access the List from your other class.
Thats just an idea
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Thanks,
also, have a look at my other answer.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I konw: in pure C / C++ program I can get the path from arguments passaed to main function.
int main(int argc, char* argv[])
argv[0] - path to program.
but how to get path to executable file in MFC application ??
miQel
-- modified at 9:22 Wednesday 22nd February, 2006
|
|
|
|
|
Look at GetModuleFileName.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
thx
I still have a problem, I have made simple Dialog app. Under OK button have put some code:
LPTSTR lpFilenamem;
int retval;
retval = GetModuleFileName(NULL, lpFilenamem, 100); //*
if (retval >0 )
MessageBox(lpFilenamem);
the program crashed on line signet by //* with communicate: Unhalded exception
miQel - always learning
|
|
|
|
|
Try...
TCHAR caFilenamem[ _MAX_PATH ];
int retval;
retval = GetModuleFileName(NULL, caFilenamem, _MAX_PATH); You were passing in an uninitialized pointer.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
miqel wrote: but how to get path to executable file in MFC application ??
The same way, actually, you'll just use __argv[0] instead. You also have access to the app's m_lpCmdLine member.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
To the O.P., I do not think that you can use CWinApp::m_lpCmdLine for that - I think it only contains true arguments, excluding the executable and its path.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
True. Sorry for the mis-post.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Hi All,
Can anyone tell me how to add an icon to Windows Namespace? One way to do this is to add a key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace, but for this one needs to have admin privileges on the system. Is there a different way by which a non admin user can do the same?
Thanks and Regards,
Anil
|
|
|
|
|
If there is no similar key under HKEY_CURRENT_USER there is no different way.
Don't try it, just do it!
|
|
|
|
|
|
Anil_vvs wrote: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace
but for accessing same key in user account you need ADMIN Priviledge there too.. have a try
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|