|
I am struggling to see where virtual mode implementation is spelled out. The link you sent me is the same I've been looking at. I see descriptions of what each function does and I see code examples of OnNotify and CallBack. There's no explanation I see that explains exactly how data is added to a virtual cell other than saying OnNotify and CallBack are needed for this operation.
What I have at the moment is a working non-virtual grid. I need to make it virtual for the reasons Chris explained as to why one is needed. I can populate this non-virtual grid with data. But when I flip the switch for Virtual, poof! Nothing.
As for why I'm trying to implement a virtual grid, it's because I was told that this would be needed in order to accomplish listing lots of data on a grid control. No one around me has tried this feature so I'm left on my own to figure it out.
If I am a novice as I state? You sound like you don't believe me.
I get the idea of what Chris is trying to convey, but I don't understand the implementation.
|
|
|
|
|
Stuck At Zero wrote: There's no explanation I see that explains exactly how data is added to a virtual cell
Are you blind? From the article sample code in the "Virtual Mode" section:
pDispInfo->item.strText.Format(_T("Message %d,%d") Stuck At Zero wrote:No one around me has tried this feature
No one in your shop knows how callbacks or OnNotify work or knows how to read and understand the sample code in the article? Is this a school project?
|
|
|
|
|
I suppose I am blind but I still don't totally understand that line. Chris says "If no callback function is specified then the grid will send a GVN_GETDISPINFO message to it's parent" This led me to believe this works under the hood, or so I thought.
I have come to CodeProject because there seems to be little information out there that can explain things more for the novice. I'm not asking to be spoon fed, but I think this is your impression. I am truly sorry if the obvious for you is not obvious for me. I did say I am a novice and I am trying to do what I was told to implement.
I did not say people at my place of work did not know how OnNotify or Callbacks work. I said no one has ever done a Virtual Grid before so they do not know. I really wished this was a school project. At least I could go straight to the teacher and ask the dumb questions.
From what you're telling me, this one line will magically populate all my cells with ease. As I explained before, I have copied this into my code and I get no change in behavior. I assumed from the quote I provided above that this all worked "under the hood". Prior to trying to add this feature, I have never heard of OnNotify or Callback functions. What I still do not know is how a particular virtual cell gets the specific bit of data it needs.
Also, I do not know if this could be a problem, but my solution is based on CFormView.
|
|
|
|
|
Stuck At Zero wrote: What I still do not know is how a particular virtual cell gets the specific bit of data it needs.
The GV_DISPINFO.item member "is" the cell the OnNotify or Callback, which ever one you are using, is called for "each cell". You have the responsibility of figuring out what data needs to go into that cell.
Stuck At Zero wrote:
I suppose I am blind but I still don't totally understand that line.
It just sets the text value of the cell . I don't know how more clear that can be.
Stuck At Zero wrote: Chris says "If no callback function is specified then the grid will send a GVN_GETDISPINFO message to it's parent" This led me to believe this works under the hood, or so I thought.
Yes that behavior is "internal" to the CGridCtrl. When you "turn on" Virtual Mode, the control will send OnNotify messages if no Callback has been registered.
Stuck At Zero wrote: I'm not asking to be spoon fed, but I think this is your impression. I am truly sorry if the obvious for you is not obvious for me.
No that is not my point at all. My point is, and we see it here at CodeProject all the time, is that beginners should NOT be developing production code. They are just not capable and this instance with you is yet another example. People should actually learn how to develop software before working on production projects. No one is born knowing what is required to develop software, it is not someones fault that they don't know, however it is someone's fault, I don't know who, that a person that is not qualified to work on production projects is.
|
|
|
|
|
Okay, I will try and figure out how get what I need into the GV_DISPINFO.item member to absorb what I already pass to cells in the non-virtual mode. How do I set item.row and item.col for pDispInfo?
Out of frustration I tried using Callback and OnNotify at the same time. It seems I never have to call OnNotify because MSDN says "The framework calls this member function to inform the parent window of a control that an event has occurred in the control or that the control requires some kind of information." Did I understand this correctly or must I actually call on OnNotify?
Understood on the beginners comment and I don't disagree. They pay my bills so I'm willing to learn. It's probably not the most efficient way of doing things but it's the OJT or self-discovery mentality. It works sometimes. Other times not. This is one of those other times for me.
For now my work is restricted to MFC stuff and unmanaged code which I'm not so sure the importance of that is, but learn I must.
Thanks for the help. This may be the nudge in the right direction I needed. Is there a really good MFC book out there you'd recommend for a newb like me?
|
|
|
|
|
Stuck At Zero wrote: How do I set item.row and item.col for pDispInfo?
No, you "get" the column and row, that's what you use to know what information goes into that specific cell. Also note the ODCACHEHINT message which will give you the entire range of cells that are going to be asked for in the subsequent GVN_GETDISPINFO messages. The idea there is that you would query a database or read a file for all the cell data required and cache it for use in the subsequent GETDISPINFO messages rather than doing all that work for each cells message.
Stuck At Zero wrote: Is there a really good MFC book out there you'd recommend for a newb like me?
Oh i wouldn't know any longer, I started back in the 90's and there where decent books then. There are tutorials on MSDN and such but issues like callbacks are before MFC, they are basic C concepts and OnNotify is also something you have to understand conceptually. You need, as with all beginners, some basic programming concepts studying.
I started out in school learning how processors and systems worked like how they accesses memory, disks, IO ports, video memory, the stack, jumps, registers etc. Everything else is built on top of that so when you got to a high level language like C, everything just mapped back to those fundamental things so it was relatively easy to understand. It's whole new world now where people start right out with IDEs, drag and drop, and high level languages and then try to learn things going backwards towards the fundamentals after they are already developing production code and run into the issues. You can see how I have no experience with that so it is difficult to advise how to do it that way.
|
|
|
|
|
Stuck At Zero wrote: Did I understand this correctly...
Yes.
Stuck At Zero wrote: ...must I actually call on OnNotify?
No. It's a virtual function that the framework calls. When you respond to the notification from within the OnNotify() method, you are telling the grid control what to display.
Think of it this way. With a non-virtual control, you tell the control what to display and where, and it goes off and does so. With a virtual control, it will tell you that it needs something to display at such-and-such row/column, and it's up to you to provide that. Any clearer?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am inputing from a text file.
Example of text file:
Total 100252 252562 11021
Trial 250 32 8
Attributed to 2526 2500 210
Daily trial 25 13 1
Here is a snippet of the code I am using.
while(input1>>word>>num1>>num2>>num3)
{
if(word == "Total")
{
total1+=num1;
total2+=num2;
total3+=num3;
}
else
{
wordCount[word] += num1; //map of string,int
single[word] += num2; //map of string, int
compound[word] += num3; //map of string int
}
}
I use this but I am trying to figure out how to attack words with spaces...(attributed to & daily to from e.g above) Currently it will only pick up single words such as Trial and the numbers following it. I am trying to read in the entire word 'attributed to' into string word;
Definately a noob to programming so any and all help/suggestions appreciated.
|
|
|
|
|
Hi,
if I have understood what you want... it is just to take every single word limited by spaces and concatenate it to a string for the entire line, as you already make. If every line may have a different number of words... then make it in other way, per letters.
for (int i = 0; char != "\n"; i++) //While not an End of a line
{
if (char == " ") //If it's an empty space
continue;
else
myWord[i] = char;
}
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Not sure if I'm suppose to reply or not but oh well...
Thanks for the help. I looked at it and it gave me another idea. Since I was controlling the format of the input file, I just decided to have a word then '\t' delimiter then num1 tab num2 tab num3 endl
Here's what it looked like codewise:
while(getline(input1, word, '\t')) //reads the first line of input until the first tab delimiter is found
{
input1>>num1>>num2>>num3; //inputs the numbers associated with the word respectively
if (word == "Total") //Total is a separate data set that needs to be kept away from rest of data
{
total1+=num1;
total2+=num2;
total3+=num3;
}
else
{
wordCount[word] += num1; //take the word and if new add it to the maps
single[word] += num2; //otherwise if word already exists just update the count
compound[word] += num3;
}
getline(input1, word, '\n'); //formatting trick so that the endline delimiter wouldn't become new word
}
--------------------------
I'm new to programming and still learning so I am open to any suggestions or comments you or anyone else may have.
Once again thanks.
|
|
|
|
|
You didn't need to answer, but it is always good to know that something was helping
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hello good people! How are you doing?
Well, I need some help here and maybe someone could help me.
I'm tryng to do something like a VuMeter (like this one), but my control have a bitmap as background and need to be 'covered' and 'uncovered' depending of the value. Something like a layer above the bitmap.
I use
<br />
CDC::SelectObject(&my_bitmap);<br />
to set the bitmap as background.
I don't have much experience in GDI or device context, and if someone have some code example or something it'll be really helpfull.
Thanks!
Best regards!
-- modified at 15:23 Tuesday 17th July, 2007
|
|
|
|
|
Ops... I get it!
Minutes after post this message I made some changes in my code and everything works fine.
Thanks everyone!
|
|
|
|
|
Hi all.
Due to an upgrade to Vista, I'm also upgrading my projects from VC++ 6.0 to VC++ 2K5. I have a strange problem, probably due to my limited knowledge of Vista / VC++ 2K5.
Say I have this code compiled with VC++ 6.0:
CDialog* pDialog = NULL;<br />
try<br />
{<br />
pDialog->Detach();<br />
}<br />
catch(CException* e)<br />
{<br />
e->Delete();<br />
}<br />
catch(...)<br />
{<br />
}
No problem at all, the exception is handled. If I compile the same code with VC++ 2K5, I get a second chance exception. Both in debug en release versions. How come?
-----------------------
"Hey, Eddie, can I pour you a beer?"
"A little early, isn't it, Richy?"
"For a beer?"
"No, for stupid questions."
|
|
|
|
|
If you want to catch SEH exceptions like that (the C++ way) then you can enable it...
Project/Properties/C++/Code Generation/enable C++ exceptions
set to Yes with SEH exceptions (/EHa)
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Thanks. Works with that option.
Actually, that's kind off silly. The code clearly states I want to catch exceptions. It makes no sense that you also have to enable an option to do what you've written in code.
Hope there aren't many of these pitfalls. Any article on stuff like this so I can educate myself?
-----------------------
New and improved: kwakkelflap.com
"Hey, Eddie, can I pour you a beer?"
"A little early, isn't it, Richy?"
"For a beer?"
"No, for stupid questions."
|
|
|
|
|
|
Hello
I find that when I double-click a .dsw file (VC++ 6.0 workspace) it will launch VC++ 6.0 and open it as expected.
However if I double-click a second .dsw file while the first is still open, it reuses the first VC++ instance (effectively closing the first one) instead of spawning a second VC++ process thereby having two (which is what I want). In the end I have to remember to first start VC++ 6.0 and then open the workspace to prevent the closing of my first workspace.
I notice that this behavior does not occur with Visual Studio.NET (2003 anyways).
I did check all options and settings in VC++ 6.0 as well as the online product documentation here (to no avail):
http://msdn2.microsoft.com/en-us/library/aa468126.aspx[^]
Might anyone know how I can change things such that a new instance of VC++ 6.0 is started when a .dsw file is dbl-clicked when there is already a workspace open?
Thanks !
Sincerely,
Christopher Brack
|
|
|
|
|
Even I am interested in knowing how
Thammadi
|
|
|
|
|
Hi All,
I have an existing ActiveX DLL (Project in Visual Studio 6.0), I want to convert it to ActiveX EXE, I want to do it in VS 6.0 only, what is the best way to do that?
Please help me on the same.
Thanks,
Anand.
|
|
|
|
|
Anand Todkar wrote: ActiveX EXE
Uuh ?? What is an ActiveX exe ??? You mean you want to have a plain standard application ?
What does this ActiveX do ? And what are you trying to do exactly ?
|
|
|
|
|
Ok.. Forget ActiveX .. Is it possible to convert DLL created in V.S. 6.0 to EXE ??
Thanks,
Anand.
|
|
|
|
|
Hello!
I want to know that is possible to code a simple DLL, and when it´s loaded in a program, it will check for other loaded DLLs, and do simple actions, based on the loaded dlls, like send a msgbox, etc.
Example:
Program is running ( with the sample DLL that checks for my.dll ) -> my.dll is loaded by the program -> sample DLL will check that my.dll is loaded by the program and send a msgbox ("Hi, the my.dll is loaded by the program" ).
Anyone can post or link to example compilable source on how to do this?
Thanks in advance!
Chris Christian
|
|
|
|
|
Look at this article here
It is mainly about how to get loaded DLL reference counts, but it talks about a structure containing the "linked list of loaded modules", so it should help you with your problem
Hope this helps!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Reading the article now. Thanks for the help.
Chris Christian
|
|
|
|