Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - (WORKAROUND) Task Dialog with ImageManager
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

(WORKAROUND) Task Dialog with ImageManager

 Post Reply Post Reply
Author
Message
chrisABC View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2008
Status: Offline
Points: 258
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisABC Quote  Post ReplyReply Direct Link To This Post Topic: (WORKAROUND) Task Dialog with ImageManager
    Posted: 16 February 2009 at 5:38am
I have some icons loaded into an ImageManager control, on same Form as TaskDialog control, but I cannot get the Dialog to show icons from the Image Manager.  Here is what I am trying:

TaskDialog.MainIcon = xtpTaskIconCustom
TaskDialog.MainIconHandle = ImageManager.Icons.GetImage(100, 16).Handle




The TaskDialog displays my text and works OK, but no icon. Can you tell me what is wrong?

Thanks to Aaron for explaining I need to use an intermediate Object.
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2009 at 7:13am
Hi Chris,
 
This will work:
 
    Dim stdPic As Object 'See Note 1.
    'Dim stdPic as StdPicture 'See Note 2.

    Set stdPic = ImageManager.Icons.GetImage(0, 32).CreatePicture(xtpImageNormal)
   
    With wndTaskDialog
        .MainInstructionText = "Some text...."
        .MainIconHandle = stdPic.Handle
        .MainIcon = xtpTaskIconCustom
        .ShowDialog
    End With
 
 
Note 1. //this will work also but: see post https://forum.codejock.com/forum_posts.asp?TID=12868
 
Note 2. //this will work also but: see post
 
 
With second option it isn't clear if this will support alpha images (first one doesn't), well see for yourself in post and maybe you will get a reply from support
 
 
 
 
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....
Back to Top
chrisABC View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2008
Status: Offline
Points: 258
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisABC Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2009 at 8:53am
Thanks Aaron, that works fine.

I had previously tried dropping a PictureBox on the form and using:
   Set Picture1.Picture = ImageManager.Icons.GetImage(ID, 32).CreatePicture(xtpImageNormal)
   TaskDialog.MainIconHandle = Picture1.Image.Handle

The PictureBox correctly displayed the icon, but TaskDialog did not.

So as you suggest I tried using:
    Dim Pic as Object
    Set Pic = ImageManager.Icons.GetImage(ID, 32).CreatePicture(xtpImageNormal)        ' Exactly same as above
    TaskDialog.MainIconHandle = Pic.Handle

And TaskDialog now correctly shows the icon. :-)


?? I do not understand why my
  TaskDialog.MainIconHandle = ImageManager.Icons.GetImage(ID, 32).CreatePicture(xtpImageNormal).Handle
      does not work  (ie. without going through the intermediate Object).

Anyway, problem solved. THANK YOU Aaron.
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
Back to Top
chrisABC View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2008
Status: Offline
Points: 258
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisABC Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2009 at 10:03am
Additional Question.

It looks as if the TaskDialog always resizes the icon to a fixed size. I don't suppose there is any way to have larger icons displayed.....?

Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2009 at 10:07am
Hi Chris,
 
ImageManager contains only ONE Bitmap and that's why it returns always same handle. There's a post somewhere in CJ forum about this...
 
Well, it works for you (and me) 
 
 
 
 
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....
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2009 at 10:16am
Hi Chris,
 
I believe you can't assign images larger than 32x32.
 
 
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....
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2009 at 12:03pm
Originally posted by chrisABC chrisABC wrote:

Thanks Aaron, that works fine.

I had previously tried dropping a PictureBox on the form and using:
   Set Picture1.Picture = ImageManager.Icons.GetImage(ID, 32).CreatePicture(xtpImageNormal)
   TaskDialog.MainIconHandle = Picture1.Image.Handle


?? I do not understand why my
  TaskDialog.MainIconHandle = ImageManager.Icons.GetImage(ID, 32).CreatePicture(xtpImageNormal).Handle
      does not work  (ie. without going through the intermediate Object)
.

 
Hi Chris,
 
  1. You have to replace Image with Picture
  2. Oleg said and I quote:
    "As we wrote in release notes for 11.2.1, ImageManager now have only 2 GDI Bitmaps that contains all icons. So developers can have 1000 icons in single image manager and don't worry about GDI objects number. So now Handle return common bitmap handle :( "             So .Handle returns the BitmapHandle and will be always the same.  
 
btw. Did you test it (what I previous wrote) with alpha images?
 
 
 
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....
Back to Top
chrisABC View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2008
Status: Offline
Points: 258
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisABC Quote  Post ReplyReply Direct Link To This Post Posted: 19 February 2009 at 3:47am
Originally posted by Aaron Aaron wrote:

(Chris said)
?? I do not understand why my
  TaskDialog.MainIconHandle = ImageManager.Icons.GetImage(ID, 32).CreatePicture(xtpImageNormal).Handle
      does not work  (ie. without going through the intermediate Object)
.
  
  

    .Handle returns the BitmapHandle and will be always the same.
  
 


But in the above I am getting Handle of   GetImage.CreatePicture    which is just a single image, so I would have thought it would be OK. But it doesn't work.  However, if I assign    GetImage.CreatePicture  to an Object, and then use Handle of the Object, it works fine.

Anyway it works, so I will not worry.
All the images I have been using are 32bit alpha.
Thanks again for your help.
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.