| |

VerySource

 Forgot password?
 Register
Search
View: 760|Reply: 4

Excuse me: In SDK programming, how can ListView not display data?

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-16 12:00:01
| Show all posts |Read mode
In SDK programming, the Report property of ListView has been formulated.
Then I started to populate the ListView with data, but the data was not always displayed on the interface. What is going on? Use wide characters
Below is the code
LVITEM pitem;
pitem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
pitem.state = 0;
pitem.stateMask = 0;
pitem.iSubItem = 0;
for (int i = 0; i <6; i ++)
{
pitem.iItem = i;
ListView_InsertItem (hListView,&pitem); // hListView is the handle of the control
for (int j = 0; j <3; j ++)
{
ListView_SetItemText (hListView, i, j, _T ("justtry")); // first
}
}
UpdateWindow (hListView);
Reply

Use magic Report

4

Threads

16

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 Pakistan

Post time: 2020-1-22 23:27:02
| Show all posts
Where is your column established? ?
Reply

Use magic Report

4

Threads

16

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-1-23 00:27:02
| Show all posts
LVCOLUMN lvc;
ZeroMemory (&lvc, sizeof (LVCOLUMN));

lvc.pszText = "column1";
lvc.fmt = LVCFMT_CENTER;
lvc.cx = 80; // Column width
lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_FMT;
ListView_InsertColumn (hListView, 0,&lvc); // Insert the first column
lvc.pszText = "column2"; // Column header
ListView_InsertColumn (hListView, 1,&lvc); // Insert the second column
lvc.pszText = "column3";
ListView_InsertColumn (hListView, 2,&lvc); // Insert the third column
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-26 17:45:01
| Show all posts
I have added columns in the previous code.
First InsertColumu, then InsertItem.
Well, try again ~
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-18 15:30:01
| Show all posts
lvc.iSubItem = 0;
ListView_InsertColumn(hListView,0,&lvc); //Insert the first column
lvc.pszText="column2";//Column title
lvc.iSubItem = 1;
ListView_InsertColumn(hListView,1,&lvc); //Insert the second column
lvc.pszText="column3";
lvc.iSubItem = 2;
ListView_InsertColumn(hListView,2,&lvc); //Insert the third column

To specify iSubItem
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list