Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Setting Disabled Icon during run time
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Setting Disabled Icon during run time

 Post Reply Post Reply
Author
Message
blockwood View Drop Down
Groupie
Groupie


Joined: 23 March 2004
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote blockwood Quote  Post ReplyReply Direct Link To This Post Topic: Setting Disabled Icon during run time
    Posted: 08 April 2004 at 10:08pm
Hi,

can you post code snipped of how to Set Disabled Icon during run time.

would the easiest way to do it is to change the IconId property when the enabled/disabled state changes?
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 08 April 2004 at 11:07pm

Dim Control As CommandBarControl

Set Control = CommandBar.FindControl(, ID_EDIT_COPY,,True)
If Not Control Is Nothing Then
    Control.enabled = False

EndIf

Yes, you can change IconId, but if you use the ImageManager control you can place your normal, disabled, and hot icons all in one place and it will automatically use them.  Just right-click on the ImageManager control and select the Id of the image you want to change the "disabled" icon.  If it needs to be 2 different disabled icons, then you simple change IconId to the Id of another Image.



Edited by SuperMario
Back to Top
blockwood View Drop Down
Groupie
Groupie


Joined: 23 March 2004
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote blockwood Quote  Post ReplyReply Direct Link To This Post Posted: 08 April 2004 at 11:32pm
you mean

Dim Control As CommandBarControl

Set Control = CommandBar.FindControl(, ID_EDIT_COPY,,True)
If Not Control Is Nothing Then
    Control.iconid = DISABLED_ICON_CONSTANT
EndIf

right? if so that works. thx for reply
Back to Top
blockwood View Drop Down
Groupie
Groupie


Joined: 23 March 2004
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote blockwood Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2004 at 5:05pm
I've just gotten around to implementing this. I had some disabled icons drawn up.

If you use ImageList control I can't get a disabled icon to display a graphic. it just greys out the block shape of the icon

UseDisabledIcons property doesn't seem to have any effect.

What I want to do is disable a control and then have it show my custom disabled icon graphic

Here is the code I have now

        Set Control = .Add(xtpControlButton, ID_RUN_STOP, "Stop", -1, False)
        Control.DescriptionText = "Stop"
        Control.Enabled = False
        Control.IconId = DISABLED_SAVE

...

    '   Use the disabled icons
    c.Options.UseDisabledIcons = False

Is what I'm trying to do possible with ImageList?
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2004 at 5:23pm
Just use the new ImageManager control, it is allot easier to use.  
Back to Top
blockwood View Drop Down
Groupie
Groupie


Joined: 23 March 2004
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote blockwood Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2004 at 11:22am
i don't necessarily agree that it is easier to use, in all cases, because it doesn't support mask edit color - so we would have to rework all of our bitmaps or convert them to gifs. a lot of work to get disabled icons to work.

I appreciate the new ImageManager control and that it abstracts the problem of disabled icons (it will be a great help to people) but for people who have existing apps. designed around imagecontrol - switching to ImageManager is no small task.

If there are any suggestions as to how I can convert my existing bitmaps with grey background (used as mask color) to the required ImageManager format I am all ears. We have nearly 80 buttons

If not is there a solution to this problem using ImageControl or are disabled icons not a feature that work with ImageControl?

So far it is ony issue I have with codejock I haven't been able to figure out - and I have spent probably 50+ hours integrating it into my apps. If I could get disabled icons to work it would be great.

TIA - Brian
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2004 at 12:35pm
All you need to do is change the "grey" background of the image to the "Erase" color when you are adding them to the ImageManager control.  Just select the "fill tool" and click on the "Erase" color and change the "grey" to "erase".  This might sound like allot, but it take less than a minute to do each image.  If you are using Alpha icons, then the transparency layer will be used by the ImageManager control and you will not need to use the "Erase" color.

Edited by SuperMario
Back to Top
blockwood View Drop Down
Groupie
Groupie


Joined: 23 March 2004
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote blockwood Quote  Post ReplyReply Direct Link To This Post Posted: 19 April 2004 at 8:52am
actually i have found out a better solution.

first - I made an assumption that was erroneous. I figured codejock could not automatically change image to disabled colors by itself! codejock can - how I don't know. but it's a great feature.

I *assumed* you needed to create a disabled icon and handle it programmatically - nope - cojejock does this for you.

the problem is - if you set theme after loading toolbar this neat disabled effect is lost and the image is just blocked out.

to get it back just add

        .Options.UseDisabledIcons = True
        .RecalcLayout

each time you set the theme

so my code looks like this

    With CommandBars
        .VisualTheme = Id
        .Options.UseDisabledIcons = True
        .RecalcLayout
    End With

you no longer need to worry about creating custom disabled icons or managing it programmatically. just disable and enable buttons and codejock will do the rest.
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 19 April 2004 at 9:07am
I thought you wanted to use your own "custom" disabled icon.  That is why i suggested to use the ImageManager control, it makes it wasy to add your own disabled icon.
Back to Top
blockwood View Drop Down
Groupie
Groupie


Joined: 23 March 2004
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote blockwood Quote  Post ReplyReply Direct Link To This Post Posted: 19 April 2004 at 9:22am
i "did" but only because i didn't realize codejock had integral disabled icon functionality built in.

with this i'm not sure why anybody would want to create their own disabled icon.

i still am not a big fan of the ImageManager - and I disagree that even with disabled icons it is "easier" when you factor in you have to manually edit each bitmap, loading images in ImageManager is cumbersome (I can select 100 bitmaps at a time and load them into ImageControl all at once) etc.

but the critical point is that it can be done easily with imagecontrol and that codejock will create disable icons on it's own - i think it's an incredible feature
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.172 seconds.