Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, May 10, 2006 8:01:31 AM(UTC)

Groups: Registered
Posts: 19

The following code fragment intends to update the image list control
image to (a) set it as not selected, and (b) update its image from a bitmap window bitmap handle

        LILITEM itm;
        L_INT res=0;
        if (prevSelection>=0) {
  (c)      itm.uStructSize=sizeof(LILITEM);
  (c)      itm.uBitmapStructSize=sizeof(BITMAPHANDLE);
 (a)       res=m_pImageList.GetItem(&itm,prevSelection);
            itm.pBitmap = m_bitmapWindow.GetHandle();
 (b)      res=m_pImageList.Update(&itm,prevSelection);

The call to GetItem (a) returns 1. However, the call to Update (b)
returns -789 even though I've initialized the struct size and
bitmapstructsize.  I also tried commenting out the assignment of
the struct and bitmap struct sizes (lines (c)), hoping that the call to
GetItem would initialize those correctly.  Unfortunately if (c) lines are commented out, then getItem also returns -789.

I note that the example code fragment in the LTCLIB.PDF document does not initialize these fields.


Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, May 14, 2006 5:41:44 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)


What is the exact LEADTOOLS version that you use?
However, I checked this issue on my machine using the latest v14.5 patches and the problem is not active.
I checked this issue using the following code:
LBitmapBase Bitmap;
LImageListControl m_ImgList;
int nRet;

// get the item's image
m_ImgList.GetItem(&Item, 0);// get first item
// flip the image

Item.pBitmap = Bitmap.GetHandle();
// change the item's image and text
Item.pText = TEXT("Flipped Image");
Item.uStructSize = sizeof(LILITEM);
nRet = m_ImgList.Update(&Item, 0);// update the item

I checked this issue using LTWVC14N.DLL build number If you use older build number from the DLL, please download and install the latest LEADTOOLS patches from our support site http://support.leadtools.com and retry the same issue.

Please let me know how it goes.

Maen Badwan
LEADTOOLS Technical Support
#3 Posted : Monday, May 15, 2006 9:23:49 AM(UTC)

Groups: Registered
Posts: 19

DLL appears to be

#4 Posted : Monday, May 15, 2006 11:01:00 AM(UTC)

Groups: Registered
Posts: 19

ran the patch, upgrading to, rebuilt my application.

Problem persists. 

Does the API support updating the bitmap handle or must one delete the prior item and insert a new one?

#5 Posted : Monday, May 15, 2006 2:43:36 PM(UTC)

Groups: Registered
Posts: 19

I suspect somewhere I am getting tripped up with references.

The application I am building maintains a bitmap list of scanned pages
from documents.  The bitmap window shows the selected page. 
The image list shows reductions of each page with the selected page highlighted.

The user can rotate each page, and those changes need to be saved in
the bitmap list.  So when the rotate left or rotate right command is processed, I am attempting to

a) save the modified bitmap from the bitmap window into the bitmap list
b) update the image list so the page reduction shows the rotation

Here's the steps I am taking

bitmapWindow->Rotate(9000);   // rotate 90 degrees
bitmapList.SetItem(selectedPage,&bitmapWindow,FALSE);  // store updated window bitmap in bitmap list
LILILTEM item;  ZeroMemory(&item,sizeof(LILITEM));
(a) L_INT res=bitmapList.Update(&item,selectedPage);

(a) res = -789

But if I call ImageList.Update() after first retrieving the ImageList
bitmap handle and rotating that image, then that works fine.  The
problem is I am not constraining the rotation only to the image list control bitmap handle. 

I just don't get where my code sample is going wrong...

#6 Posted : Thursday, May 18, 2006 3:12:11 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)


I rechecked the same issue on my machine and the problem is not active. I checked it on LTWVC14N.DLL build number
I checked this issue on the Main Class Lib demo on the following path: [LEADTOOLS 14.5 directory]\Examples\CLASSLIB\MSVC5\Demo
I added a new sub menu ("Test ImageList") to the "Image List" menu in the Main class Lib demo. I used the following code to check this issue:
void CMainFrame::OnImagelistCheck()
LBitmapBase Bitmap;
int nRet;

if (m_pBrowseDlg)
memset(&Item, 0, sizeof(Item));

Item.uStructSize = sizeof(Item);
Item.uBitmapStructSize = sizeof(BITMAPHANDLE);

L_INT tmp = m_pBrowseDlg->m_Thumb.m_pImgList->GetSelectedItems(&Item);

if (Item.pBitmap)
// TODO: Add your command handler code here
m_pBrowseDlg->m_Thumb.m_pImgList->GetItem(&Item, 0);// get first item

// Rotate the image
Bitmap.Rotate(9000,ROTATE_RESIZE, RGB(255, 0, 0));

Item.uBitmapStructSize =sizeof(BITMAPHANDLE);

nRet = m_pBrowseDlg->m_Thumb.m_pImgList->Update(&Item, 0);// update the item

I am attaching the modified demo that I used to check this issue. To check this issue using the attached demo, please do the following:
1. Open the demo and run it.
2. Select "Image List">"Browse" and browse any images folder on your machine.
3. Select any item on the image list and click it to open it on a new view.
4. Select "Image List">"Test ImageList" and debug the code. When you reach the Update method you will notice that the returned value is 1.

Please recheck this issue on your side using the attached project.
If our project works on your machine, please send me your project so that I can debug the code and find the problem.

Maen Badwan
LEADTOOLS Technical Support
File Attachment(s):
Demo.zip (289kb) downloaded 24 time(s).
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.211 seconds.