Print Page | Close Window

CreateCommandBarControl And Click

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=17493
Printed Date: 06 October 2024 at 6:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CreateCommandBarControl And Click
Posted By: MottoDoki
Subject: CreateCommandBarControl And Click
Date Posted: 27 October 2010 at 9:52am

Hello everyone,

I'm trying to use a ControlMarkupLabel on my CommandBar and doing like RibbonSample App Sample (but no ribbon style Embarrassed  ):
Dim ToolBarMenuFile As CommandBar
Dim ControlWS As CommandBarControl
Set ToolBarMenuFile = CommandBars.Add("TBMenu_File", xtpBarTop)
With ToolBarMenuFile
            Set ControlWS = CommandBars.CreateCommandBarControl("CXTPControlMarkupLabel")
            ControlWS.Id = ID_CMDBAR_MDIMAIN_WS
            ControlWS.Caption = "<TextBlock TextAlignment='Center'><Image Margin='0, 0, 0, 0' Cursor='Hand' Source='file://mypicture.ico'/></TextBlock>"
            ControlWS.BeginGroup = True
            ControlWS.Enabled = True
            .Controls.AddControl ControlWS
End With

In that case CommandBars_Execute event never fire.

So i tried something else like that, using external  MarkupLabel and custom control:
Dim ToolBarMenuFile As CommandBar
Dim ControlWS As CommandBarControl
Set ToolBarMenuFile = CommandBars.Add("TBMenu_File", xtpBarTop)
With ToolBarMenuFile
                       mklWS.Caption = "<TextBlock TextAlignment='Center'><Image Margin='0, 0, 0, 0' Cursor='Hand' Source='file://mypicture.ico'/></TextBlock>"
            Set ControlWS = CommandBars.CreateCommandBarControl("CXTPControlCustom")
            ControlWS.Style = xtpButtonIcon
            ControlWS.BeginGroup = True
            ControlWS.Id = ID_CMDBAR_MDIMAIN_WS
            ControlWS.Flags = xtpFlagControlStretched
            ControlWS.Handle = mklWS.hWnd
            .Controls.AddControl ControlWS
EndWith

In this case CommandBars_Execute event fire after 2 click and the first click make the icon to disappear Dead

So if anyone have any idea i will really appreciate thank you

Using CJ 13.4.1 Under XP sp3 And VB6 sp6 Icon Size are 32*32






Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net