|
I have a Listview window with 10 columns. Data are display in the column going left to right with the newest data at the right most column. A horizontal scrollbar is automatically displayed at the bottom and the thumb of the scrollbar is at the left side. I want to put the thumb of the scrollbar to the right side so the when you go to that window you see the newest data first. I tried using GetScrollInfo() but I keep on getting "The window does not have scroll bars." from GetLastError(). I tried using SetScrollInfo() and passing in different values for nPos of the SCROLLINFO structure to see if it would move the thumb, but it doesn't seem to work. Does anyone know how you I get the thumb of the scrollbar to be at the right side?
|
|
|
|
|
|
Hi Mark, thanks for the help, ListView_Scroll() solved the problem I asked. Now I have another problem, when I press the left or right arrow on the scrollbar, I don't receive any WM_HSCROLL messages. I need to check when the thumb is at the far right and the right arrow is press I need to check for newer data and when the thumb is at the far left and the left arrow is press to retrieve older data. Any suggestion why I am not receiving any WM_HSCROLL messages?
|
|
|
|
|
Same situation - we don't know how the common controls are implemented internally
so we can't assume these window messages are available in the standard way.
Just like you should be using ListView messages to control the control ( ), you should
be looking for ListView notifications (LVN_xxxx) instead of standard window messages.
See LVN_BEGINSCROLL/LVN_ENDSCROLL
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
FYI...
I recommend keeping a link to this:
Control Library[^]
or the equivalent link in your local development MSDN library.
It's the documentation for all the Windows common controls, including messages,
notifications, and APIs.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, I am using Visual Studio 2005 C++/CLI. I have been trying to populate a cell in a grid control but I haven't been able to find any examples that are not C#. I thought I needed to do something like...
DataGridViewCell myCell = gcnew DataGridViewCell(rowValue, colValue);
dataGridview1->CurrentCell = myCell;
dataGridView1->CurrentCell->Value = "Test";
The compiler complains that an abstact class cannot be instantiated. If anyone knows of a link to a CLI example that would be great. I just can't quit seem to figure out how to populate the cells of the DataGridView control (the microsoft .NET documentation hasn't helped).
Thanks
Buck
|
|
|
|
|
DataGridViewCell is an abstract class. Thus, you cannot create an instance. However, you can do the following:
// dataGridView1 has two columns: Name and Age.
// At this point dataGridView1 does not have any rows or cells
DataGridViewRow^ row = gcnew DataGridViewRow;
row->CreateCells(dataGridView1);
dataGridView1->Rows->Add(row);
dataGridView1->Rows[0]->Cells[0]->Value = "George";
dataGridView1->Rows[0]->Cells[1]->Value = "54";
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi George,
This isn't working for me too well. I keep getting array bounding errors. Your example is much like what I have seen where you start with some number of colums but no rows or cells. What I have done is pre-define the number of rows and columns like this...
dataGridView1->RowCount = 150;
dataGridView1->ColumnCount = 120;
myArray = gcnew array<celllocation^, 2="">(dataGridView1->RowCount, dataGridView1->ColumnCount);
for(int i = 0; i < dataGridView1->RowCount; i++)
for(int j = 0; j < dataGridView1->ColumnCount; j++)
{
dataGridView1->Columns[j]->Width = 8;
dataGridView1->Rows[i]->Height = 6;
}
This code will display a 120 column by 150 column grid (although it does take 10 seconds to display) which is what I want, but how do I navigate it? It would be intuitive to do something like...
dataGridView1(cell_row_value, cell_cloumn_value) = what goes into the cell
but that doesn't work. It seems I have to use the Cell->Value property but I have to set the (row, col) coordinates of the cell and I can only set the coordinates with a DataGridViewCell^ data type and I can't instantiate a DataGridViewCell^ because it's abstract. I can't figure out how to say 'Make the current cell the cell at row coordinate X and column coordinate Y'. This is what I need to know.
Thanks
Buck
|
|
|
|
|
Buck,
In your original post, you did not give enough information to warant a specific answer to your current needs. However, see if this may work:
for (int i = 0; i < 120; ++i)
{
DataGridViewTextBoxColumn^ col =
gcnew DataGridViewTextBoxColumn;
col->Name = "col" + i.ToString();
col->HeaderText = i.ToString();
dataGridView1->Columns->Add(col);
}
for (int i = 0; i < 100; ++i)
{
DataGridViewRow^ row =
gcnew DataGridViewRow;
dataGridView1->Rows->Add(row);
}
dataGridView1->Rows[9]->Cells[4]->Value = "George";
There may be a faster way of doing this, and I will dig a little deeper. I don't do much Window Forms programming.
-- modified at 18:32 Thursday 20th September, 2007
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi George,
Oh by the way, when I click on the close button in the top right most corner of the form that contains the DataGridView conrol it takes the same amount of time to exit the form as it does to display it (ten seconds).
Buck
|
|
|
|
|
Reading the documentation, I came up with this:
for (int i = 0; i < 120; ++i)
{
DataGridViewTextBoxColumn^ col =
gcnew DataGridViewTextBoxColumn;
col->Name = "col" + i.ToString();
col->HeaderText = i.ToString();
dataGridView1->Columns->Add(col);
}
dataGridView1->Rows->Add(100);
dataGridView1[3, 9]->Value = "Buck";
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi All,
I want to insert smiley faces in the Rich Edit Control (like Yahoo Chat)...can anyone help me in this issue..
just tell me how to load the smiley and display it in the Rich Edit control.
Thanks in advance,
Shiva
|
|
|
|
|
If you had used google, you would have found at least two articles:
http://www.codeproject.com/cs/miscctrl/csexrichtextbox.asp
http://www.codeproject.com/cs/miscctrl/MyExtRichTextBox.asp
|
|
|
|
|
hi,
I'm working in .NET 1.1 and I've been given an application built in MFC and I need to generate some XML log files. I wanna use the XMLtextwriter class but as far as I see it, it doesnt allow you to add a namespace suchas
using namespace System::Xml;
So what should I do?? is there some way I can use the XmlTextWriter class in an MFC application?
Thanks in advance
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
|
XmlLite is looking like some thing quite helpful I'm exploring it nnow.. lets see what happens then,
thanks again George!
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
well I've downloaded and installed the XmlLite upgrade for WinXp and I've also seen the info abt using Xmllite over MSDN online. The problem I'm facing now is that all the samples given over there are for VS 2005 whereas I'm using VS 2003 and I tried to run the sample but its not getting the 'xmllite.h' file. I've searched for it but its no where to be found!! but the interesting thing is that xmllite.dll is there in the System32 directory.
All I wanna do is to use the IXmlWriter Interface to write the XML document. but HOW DO I DO IT IN VS2003?? Thats the big question???
Any suggestions??, samples?
Thanks
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
well I just found the answer myself , Its the Windows SDK for Vista! Thats what I need. and its 1187.5MB
Why in the world do i have to download the whole thing just to use xmllite.lib and .h files??
Isnt there anyway I can do the work with downloading this whole thing?
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Hi,
Let suppose, there is an exe file and it has a certain output at console. Is it possible to read that console output anyway?
I would appreciate the suggestions.
Wali
|
|
|
|
|
Please don't cross-post. Posting your question in the appropriate forum is sufficient.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Why you asked this question again on this forum?
|
|
|
|
|
|
Hi, I am using Visual Studio 2005 C++/CLI. I posted this before with no responses so maybe no one knows. I want to use an existing Form from another project (I don't want to recreate the 50 controls on the Form). I can include the Form into my project but if I then try to modify the Form from the Solution Explorer by right clicking on the form name and selecting 'View Designer', I can't because this option is not available to me like it is with the Forms that I created in this project. Can Forms AND their design views be copied from one project to another?
Thanks
Buck
|
|
|
|
|
What you are talking about may be possible but it might be better asked in a Visual Studio forum since your question deals more with a VS feature. IMHO, the relationship between C++/CLI and the View Designer can be broken with little effort.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|