SOLVED - AddIcon Fault? |
Post Reply |
Author | |
AndyWilton
Groupie Joined: 03 June 2008 Status: Offline Points: 82 |
Post Options
Thanks(0)
Posted: 30 March 2009 at 12:18pm |
Hi All,
I'm having trouble getting the AddIcon method working in the ReportControl. I'm familiar with this method and use it with various other controls (eg, CommandBars, ShortcutBar, TaskPanel etc).
I have an icon defined which is 16x16. If I use the LoadIcon method then the icon is correctly set for a column, but if I switch to use the AddIcon method it doesn't display.
Has anybody used this successfully?
Regards,
Andy
|
|
Product: Xtreme SuitePro (ActiveX) v11.2.1 -> v15.2.1
Platform: Windows XP / Vista / Win 7 Language: Clarion 5.5 -> C8.x ====================================== Andy Wilton |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
try to use wndReportControl.SetImageList YourImageList - you can assign image to ImageList in VB Form Editor and set proper mask to use transperent icons
|
|
AndyWilton
Groupie Joined: 03 June 2008 Status: Offline Points: 82 |
Post Options
Thanks(0)
|
Hi Mark,
Unfortunately, the language that we use is Clarion and this doesn't support the ImageList function so I can't really use SetImageList.
As I mentioned earlier, the AddIcon works perfectly in Clarion for all of the other controls but will not work for the ReportControl - is there something different in this control or does it just not work?
Regards,
Andy
|
|
Product: Xtreme SuitePro (ActiveX) v11.2.1 -> v15.2.1
Platform: Windows XP / Vista / Win 7 Language: Clarion 5.5 -> C8.x ====================================== Andy Wilton |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
still try wndReportControl.SetImageList YourClarionLoadedIcon
|
|
AndyWilton
Groupie Joined: 03 June 2008 Status: Offline Points: 82 |
Post Options
Thanks(0)
|
Hi Mark,
Excuse my ignorance but doesn't that method require an object whereas all I have is a handle to a compiled in icon - that's why I want to use the AddIcon method.
Can you think of any other way to get AddIcon to work?
Regards,
Andy
|
|
Product: Xtreme SuitePro (ActiveX) v11.2.1 -> v15.2.1
Platform: Windows XP / Vista / Win 7 Language: Clarion 5.5 -> C8.x ====================================== Andy Wilton |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Internally now ReportControl use ImageManager this is why I recommended to use it. Call wndReportControl.SetImageList use ImageManager inside ActiveX to pass you params.
There is old VB-way to deal with icons. You can try it also.
Dim iconArray(0 To 9) As Long
'There are 10 icons in the Bitmap file, the bitmap file is 160x16,
'which contains 10 16x16 icons. You need to make sure that there is 'an element in the array for each icon in the Bitmap. 'Width of icons = Width of Bitmap / number of elements in array 'I.e. Width of icons = 160/10 = 16 'IconId can not be Zero (0), so do not assign 0 to any of the array elements iconArray(0) = COLUMN_MAIL_ICON iconArray(1) = COLUMN_IMPORTANCE_ICON iconArray(2) = COLUMN_CHECK_ICON iconArray(3) = RECORD_UNREAD_MAIL_ICON iconArray(4) = RECORD_READ_MAIL_ICON iconArray(5) = RECORD_REPLIED_ICON iconArray(6) = RECORD_IMPORTANCE_HIGH_ICON iconArray(7) = COLUMN_ATTACHMENT_ICON iconArray(8) = COLUMN_ATTACHMENT_NORMAL_ICON iconArray(9) = RECORD_IMPORTANCE_LOW_ICON 'Passing the iconArray for the "Commands" parameter will add an icon to the collection
'of icons for each item in the array. So Number of icons added = Number of elements in array. 'Icon width = Total width of Bitmap/Number of elements in array. 'The icons will be assigned the index of the array elements as an Index. wndReportControl.Icons.LoadBitmap App.Path & "\Icons\bmreport.bmp", iconArray, xtpImageNormal |
|
AndyWilton
Groupie Joined: 03 June 2008 Status: Offline Points: 82 |
Post Options
Thanks(0)
|
Hi Mark,
Thanks, I'll take a closer look at the SetImageList but I'm not convinced I'll be able to use this with Clarion.
Interesting, If I use the LoadIcon method with the desired parameters it all works fine, its just the AddIcon method - I can only presume that its faulty.
Regards,
Andy
|
|
Product: Xtreme SuitePro (ActiveX) v11.2.1 -> v15.2.1
Platform: Windows XP / Vista / Win 7 Language: Clarion 5.5 -> C8.x ====================================== Andy Wilton |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
If you use wndReportControl.Icons.AddBitmap Picture1.Picture.Handle, 1, xtpImageNormal, False it will display the image in columnheader.
|
This is PictureBox with image
If I use .AddIcon it doesn't. Columnheader image supports icons so it should work...
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
AndyWilton
Groupie Joined: 03 June 2008 Status: Offline Points: 82 |
Post Options
Thanks(0)
|
Hi All,
Ahh - found it. It was my fault after all, but I thought I'd share the answer with everyone as it could quite easily catch others out.
The AddIcon method requires the handle to the compiled in icon. To obtain this, I use the 'LoadImage' API call with parameters 4 and 5 (desired width and height) set to 0 - default size.
The problem is that even though the icon is defined as 16x16, I am getting a handle to an image of 32x32 and of course, the ReportControl doesn't like this size for its icons. If I set the width / height parameters of 'LoadImage' to 16x16 then it returns a handle to an image of 16x16 and then of course the ReportControl displays it correctly.
Regards,
Andy
|
|
Product: Xtreme SuitePro (ActiveX) v11.2.1 -> v15.2.1
Platform: Windows XP / Vista / Win 7 Language: Clarion 5.5 -> C8.x ====================================== Andy Wilton |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions 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 |