Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - For Each Control... vb net error
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

For Each Control... vb net error

 Post Reply Post Reply
Author
Message
sasa View Drop Down
Newbie
Newbie
Avatar

Joined: 19 February 2007
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote sasa Quote  Post ReplyReply Direct Link To This Post Topic: For Each Control... vb net error
    Posted: 13 June 2008 at 11:18am
Hi,
I don't understand where I make mistakes but a simple

    Dim Ctrl As XtremeCommandBars.CommandBarControl

    For Each Ctrl In TBar.DesignerControls
       TBar.FindControl(Ctrl.Id).Caption = "Caption"
       TBar.FindControl(Ctrl.Id).TooltipText = "TTips"
       TBar.FindControl(Ctrl.Id).DescriptionText = "aa"
    Next

return me an error in vb.net when Ctrl is an xtpControlButton.

The same source code work nice in vb6.

If I try to write...

    Dim Ctrl As XtremeCommandBars.CommandBarControl

    For Each Ctrl In TBar.DesignerControls
       Ctrl.Caption = "Caption"
       Ctrl.TooltipText = "TTips"
       Ctrl.DescriptionText = "aa"
    Next

... I have no errors but commandbar don't show new caption and tips value.
Where i make mistakes ??

Thanks to all
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: 13 June 2008 at 12:12pm
Hello,
 
Use Actions to change Captions/Description easy.
 
Add CommandBars.EnableActions before you add any control and
 
CommandBars.Actions(Id).Caption = "New Caption" to change all buttons with id = "Id".
 
See Actions sample.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
sasa View Drop Down
Newbie
Newbie
Avatar

Joined: 19 February 2007
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote sasa Quote  Post ReplyReply Direct Link To This Post Posted: 13 June 2008 at 1:03pm
Hello Oleg,
I receive an error NullReferenceException if I try to use method Actions.
Above there is source code:


        Dim ctrl As Control
        For Each ctrl In Me.Controls
            If TypeOf ctrl Is MdiClient Then
               cmdBarMain.SetMDIClient(ctrl.Handle.ToInt32())
            End If
        Next ctrl

        With cmdBarMain
            .LoadDesignerBars(PercorsoApp & "\MainLayout.xcb", Nothing)
            cmdBarMain(2).ModifyStyle(XtremeCommandBars.XTPCommandBarStyle.XTP_CBRS_GRIPPER, 0)

            .ActiveMenuBar.Delete()

            .Options.AlwaysShowFullMenus = True
            .Options.IconsWithShadow = True
            .Options.LargeIcons = True
            .Options.ShowExpandButtonAlways = False
            .Options.ToolBarAccelTips = True
            .Options.ToolBarScreenTips = True
            .Options.UseDisabledIcons = True
            .Options.SyncFloatingToolbars = True

            .ToolTipContext.ShowTitleAndDescription(True, XtremeCommandBars.XTPToolTipIcon.xtpToolTipIconInfo)
            .ToolTipContext.Style = XtremeCommandBars.XTPToolTipStyle.xtpToolTipBalloon
            .ToolTipContext.MaxTipWidth = 200

            .StatusBar.AddPane(0)
            .StatusBar.AddPane(1)
            .StatusBar.AddPane(2)

            .StatusBar.Font.Name = "Tahoma"
            .StatusBar.Font.Size = 10

            .StatusBar.Pane(0).Width = 180
            .StatusBar.Pane(0).Style = XtremeCommandBars.XTPStatusPaneStyle.SBPS_NOBORDERS
            .StatusBar.Pane(1).Width = 40
            .StatusBar.Pane(1).Style = XtremeCommandBars.XTPStatusPaneStyle.SBPS_NOBORDERS
            .StatusBar.Pane(2).Width = 0   ' 0 = Autro Size
            .StatusBar.Pane(2).Style = XtremeCommandBars.XTPStatusPaneStyle.SBPS_STRETCH + XtremeCommandBars.XTPStatusPaneStyle.SBPS_NOBORDERS

            .StatusBar.Pane(0).Text = "Ready to use"
            .StatusBar.Pane(1).Text = ""
            .StatusBar.Pane(2).Text = ""
            .StatusBar.Visible = True

            .EnableCustomization(False)
        End With

        cmdBarMain.Actions(ID_ANAGR).Caption = "Something"

How can I avoid problem ??

Thanks a lot
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: 13 June 2008 at 4:07pm
Hi,
Maybe ID_ANAGR actioin not found. Are you sure in MainLayout.xcb actions are enabled ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
sasa View Drop Down
Newbie
Newbie
Avatar

Joined: 19 February 2007
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote sasa Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2008 at 1:42am
Hi Oleg,
I enabled actions in commandbar but it don't show me what i ask. New source code is:

        Dim ctrl As Control
        For Each ctrl In Me.Controls
            If TypeOf ctrl Is MdiClient Then
               cmdBarMain.SetMDIClient(ctrl.Handle.ToInt32())
            End If
        Next ctrl

        With cmdBarMain
            .LoadDesignerBars(PercorsoApp & "\MainLayout.xcb", Nothing)

            .EnableActions()

            cmdBarMain(2).ModifyStyle(XtremeCommandBars.XTPCommandBarStyle.XTP_CBRS_GRIPPER, 0)

            .ActiveMenuBar.Delete()

            .Options.AlwaysShowFullMenus = True
            .Options.IconsWithShadow = True
            .Options.LargeIcons = True
            .Options.ShowExpandButtonAlways = False
            .Options.ToolBarAccelTips = True
            .Options.ToolBarScreenTips = True
            .Options.UseDisabledIcons = True
            .Options.SyncFloatingToolbars = True

            .ToolTipContext.ShowTitleAndDescription(True, XtremeCommandBars.XTPToolTipIcon.xtpToolTipIconInfo)
            .ToolTipContext.Style = XtremeCommandBars.XTPToolTipStyle.xtpToolTipBalloon
            .ToolTipContext.MaxTipWidth = 200

            .EnableCustomization(False)
        End With

        cmdBarMain.Actions.Add(ID_ANAGR, "CaptionAction", "tooltip action", "descr action", Nothing)
        cmdBarMain.Actions(ID_ANAGR).Caption = "NewCaption"
        Dim test As String = cmdBarMain.Actions.Action(ID_ANAGR).Caption

in such way, it change Caption property but new caption is not showed when I run program.

Where I'm wrong ??
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 June 2008 at 5:16am

Hi,

Actions have to be enabled in MainLayout.xcb. Open it in designer, select some controls and in propertyPages click "Enable Actions"
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
sasa View Drop Down
Newbie
Newbie
Avatar

Joined: 19 February 2007
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote sasa Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2008 at 5:44am
Thanks... thanks.... thanks.
Now it work nice. Thank you very much Oleg

Have a nice day
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: 15 June 2008 at 8:19am
:)
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.234 seconds.