Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - HOW to HIDE and ITEM?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

HOW to HIDE and ITEM?

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


Joined: 20 September 2007
Location: Puerto Rico
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote aimcorp Quote  Post ReplyReply Direct Link To This Post Topic: HOW to HIDE and ITEM?
    Posted: 05 October 2007 at 8:27am

We’re looking over the entire help file for answers before coming to this forum, also we looked the included samples, however we find the help file very poor on explanations; you click F1 over a command and the help file popped up with the command syntax, but for almost all commands there’s no source code explaining how to use it.

 

Anyway, been two days now that we’re looking the way to hide and unhide an item on a toolbar (ribbonbar) and didn’t find the way to do it from code unless we call it on the MDI form at the beginning.

 

Set ControlPreferences = RibbonBar.Controls.Add(xtpControlPopup, 5, "Preferencias")

With ControlPreferences

   .CommandBar.Controls.Add xtpControlButton, ID_PREF_REA, "Reactivate Warnings"

   .CommandBar.Controls.Add(xtpControlButton, ID_PREF_EDE, "Specialist Data")

   .Flags = xtpFlagRightAlign: .ToolTipText = "": .Width = 80

 End With

 

We want to hide

 

   .CommandBar.Controls.Add xtpControlButton, ID_PREF_REA, "Reactivate Warnings"

 

…from code and probably unhide it later

 

Is there a way to accomplish this?

 

Ariel Maisonet

Aim Corporation

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: 05 October 2007 at 10:49am
Hello,
 
All our samples have Update handler please check how it works.
 
You need add flag variable that indicates that control need to hide/show and in update handler add
 
Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
   
    On Error Resume Next
    Select Case Control.Id
        Case ID_PREF_REA:
               Control.Visible = bControlVisible
     
    End Select
End Sub
...
 
or you can enable actions:
CommandBars.EnableActions
 
and call
CommandBars.Actions(ID_PREF_REA).Visible = False.
...
or jsut use FindControl method, find this control and set its Visible propety to False.
 
 
have no idea what you did 2 days :-)
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
aimcorp View Drop Down
Groupie
Groupie


Joined: 20 September 2007
Location: Puerto Rico
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote aimcorp Quote  Post ReplyReply Direct Link To This Post Posted: 05 October 2007 at 12:10pm
First we appreciate greatly your answer, so what we say here is with good intentions:
 
====================================================
 
CommandBars.Actions(ID_PREF_REA).Visible = False.

 

Not working   return MDIform error

 

or jsut use FindControl method, find this control and set its Visible propety to False.

 

Not working   return MDIform error

 

The solucion is to set the CommandBar PUBLIC!!

 

All your samples showed DIM, we assume DIM will work on the MDI since is there located, but we have to set it Public if we want it to work (we had a hard time to figure it out).

 

Anyway we insist that your help file should be more specific, by giving a simple sample for each command you use on it.

 
Below is what we mean:  Your help file say something like this

Control Property

Description

Gets the collection of controls on the command bar.

Property type

Read-only property

Syntax (Visual Basic)

Public Property Controls() As CommandBarControls

See Also

CommandBar Object

 

It ended there, no any single sample for the syntax and how to use it

A short line for example

Set Control = .CommandBar.Controls.Add(xtpControlButton, ID_PREF_DCO, "Deactivate Copy")

Will make the help file more useful
 
Thanks!
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: 09 October 2007 at 1:25am
Hello,
CommandBars.Actions(ID_PREF_REA).Visible = False.
have to work.
Think you enabled actions after create controls. Have to call it before you create any control.
See Actions sample.
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.141 seconds.