Page 1 of 1

curItemNo doesn't seem to change

Posted: Thu May 03, 2007 6:01 am
by baileyrc
Should the curItemNo property be incremented every time an object is inserted?

e.g. if a loop had the contents

Code: Select all

   RichViewEdit1->CurItemNo;
   RichViewEdit1->InsertBullet(0,imageList);
Shouldn't CurItemNo grow?

My problem is that CurItemNo remains fixed at 0 no matter how many times the loop is executed. ItemCount remains fixed at 1 in a similar manner.

I need to accurately store CurItemNo before each InsertBullet so that I can call SetBulletInfoEd with the proper ItemNo.

I'm obviously missing something here.[/code]

Posted: Thu May 03, 2007 3:45 pm
by baileyrc
Okay -- I exaggerated a bit... The first time through the loop curitem and itemcount don't change (they stay at 0 and 1 respectively). After the second time through the loop they increment properly. Why wouldn't these change after the first pass???

Posted: Thu May 03, 2007 4:29 pm
by Sergey Tkachenko
It's better to use this code:

Code: Select all

if (RichViewEdit1->InsertBullet(0, ImageList))
{
  RichViewEdit1->SetCurrentBulletInfo(...)
}
If you want to use SetBulletInfoEd,

Code: Select all

if (RichViewEdit1->InsertBullet(0, ImageList))
{
  RichViewEdit1->TopLevelEditor->SetBulletInfoEd(RichViewEdit1->TopLevelEditor->CurItemNo, ...)
}
Two things are important:
1) InsertBullet may fail, for example if multiple table cells are selected. So check the returned value.
2) When accessing current item by its index, use TopLevelEditor property.

As for non-incrementing CurItemNo.
When you insert bullet in empty line, the bullet replaces text item, so CurItemNo is not changed (one item is removed, one item is added).