Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - How to disable an item in toolbar?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to disable an item in toolbar?

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


Joined: 26 January 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote lexicon Quote  Post ReplyReply Direct Link To This Post Topic: How to disable an item in toolbar?
    Posted: 12 December 2007 at 8:28am
How to disable an item in toolbar?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 12 December 2007 at 11:04am
Hi,
Please start learning from our samples. They have a lot of such things.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lexicon View Drop Down
Groupie
Groupie


Joined: 26 January 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote lexicon Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2007 at 2:39am
Sorry but even if i'm seeing you doing it in your samples, i still don't understand how you are doing it
Back to Top
ijwelch View Drop Down
Senior Member
Senior Member


Joined: 20 June 2006
Status: Offline
Points: 262
Post Options Post Options   Thanks (0) Thanks(0)   Quote ijwelch Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2007 at 7:36am
It will usually be in the CommandBars_Update event.
Back to Top
lexicon View Drop Down
Groupie
Groupie


Joined: 26 January 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote lexicon Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2007 at 7:46am
And how can i refer to the spesific item in Toolbar?
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2007 at 1:01pm
Set up a boolean variable for each button that you want to enable/disable.

In your CommandBars_Update event, set the enabled property for each button  to the value of the corresponding variable, like so (or you could specify each button exactly instead of using Select Case):

Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)

    Select Case Control.ID
        Case ID_FIRSTPAGEOFDOCUMENT
            Control.Checked = blnFirstPageOfDocument
           
        Case ID_SUPERVISORCHECK
            Control.Checked = blnSupervisorCheck
            Control.Enabled = blnSupervisorCheckEnable
           
        Case ID_PAGEDOWNNEXTDOCUMENT
            Control.Checked = blnPageDownToNextDocument
           
        Case ID_SPELLCHECKTOGGLE
            Control.Checked = blnSpellCheck
           
        Case ID_HOMEANDENDKEYENDOFLINETOGGLE
            Control.Checked = blnHomeAndEndKey
           
        Case ID_ENTERKEYPAGEDOWN
            Control.Checked = blnEnterKeyPageDown
       
        Case ID_SUPERVISORCHECKNOTES
            Control.Enabled = blnSupervisorCheckComments
    End Select

End Sub



When you want to change the enabled state of a button, you simply set the value of the corresponding boolean variable to the desired value.  The update event will then take over and enable/disable the button for you.
Back to Top
lexicon View Drop Down
Groupie
Groupie


Joined: 26 January 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote lexicon Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2007 at 1:40pm
The Update event happens all the time
I want the program to start with a button disabled (which i can do with Update event) and then after a button clicked to disable another one
Lets say you have a New button and a Save Button
The Save button will be disabled and when the New button clicked, the New button will be disabled and the Save button will be enabled
 
Thank you very much for your help
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2007 at 1:48pm
Right.  What I would do there is set up boolean variables in the General Declaration of the form for each of your 2 buttons.

In Form_Load set the booleans to the disable/enable values you want.

In CommandBars_Update set the enabled property of each button to the boolean value

In the click event of each button, set the boolean values to the desired state.

That should do it.
Back to Top
lexicon View Drop Down
Groupie
Groupie


Joined: 26 January 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote lexicon Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2007 at 2:34pm
Thanks a lot, that's what i want
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 14 December 2007 at 3:03pm
Jason, Thanks for help. :-)
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.027 seconds.