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

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, May 10, 2006 7:56:31 AM(UTC)
jljamison

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) {
            ZeroMemory(&itm,sizeof(LILITEM));
  (c)      itm.uStructSize=sizeof(LILITEM);
  (c)      itm.uBitmapStructSize=sizeof(BITMAPHANDLE);
            itm.uMask=LILITEM_SELECTED | LILITEM_BITMAP;
 (a)       res=m_pImageList.GetItem(&itm,prevSelection);
            itm.bSelected=FALSE;
            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:36:44 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

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:
+----------------------------+
LILITEM Item;
LBitmapBase Bitmap;
LImageListControl m_ImgList;
int nRet;

// get the item's image
Item.uMask = LILITEM_BITMAP;
m_ImgList.GetItem(&Item, 0);// get first item
// flip the image
Bitmap.SetHandle(Item.pBitmap);
Bitmap.Flip();

Item.pBitmap = Bitmap.GetHandle();
// change the item's image and text
Item.pText = TEXT("Flipped Image");
Item.uStructSize = sizeof(LILITEM);
Item.uBitmapStructSize=sizeof(BITMAPHANDLE);
Item.uMask = LILITEM_BITMAP |LILITEM_SELECTED ;
LILITEM_TEXT ;
nRet = m_ImgList.Update(&Item, 0);// update the item
+----------------------------+

I checked this issue using LTWVC14N.DLL build number 14.5.0.10. 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.

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

Groups: Registered
Posts: 19


DLL appears to be 14.5.0.4

JJ
 
#4 Posted : Monday, May 15, 2006 10:56:00 AM(UTC)
jljamison

Groups: Registered
Posts: 19


ran the patch, upgrading to 14.5.0.10, 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?


-John
 
#5 Posted : Monday, May 15, 2006 2:38:36 PM(UTC)
jljamison

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));
item.uStructSize=sizeof(LILITEM);
item.uBitmapStructSuze=sizeof(BITMAPHANDLE);
item.uMask=LILITEM_BITMAP;
item.pBitmap=bitmapWindow.GetHandle();
(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:07:11 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

I rechecked the same issue on my machine and the problem is not active. I checked it on LTWVC14N.DLL build number 14.5.0.10.
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)
{
LILITEM Item;
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
Item.uMask = LILITEM_BITMAP;
m_pBrowseDlg->m_Thumb.m_pImgList->GetItem(&Item, 0);// get first item

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

ZeroMemory(&Item,sizeof(LILITEM));    
Item.uStructSize=sizeof(LILITEM);
Item.uBitmapStructSize =sizeof(BITMAPHANDLE);
Item.uMask=LILITEM_BITMAP;
Item.pBitmap=Bitmap.GetHandle();;

LILITEM_TEXT ;
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.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
File Attachment(s):
Demo.zip (289kb) downloaded 32 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-2024, Yet Another Forum.NET
This page was generated in 0.144 seconds.