Print Page | Close Window

Forms attached to commandbar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Active-X COM Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=237
Printed Date: 22 November 2024 at 1:28pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Forms attached to commandbar
Posted By: peterhan
Subject: Forms attached to commandbar
Date Posted: 13 November 2003 at 8:56am
How can i attach a form to a command bar.like the slider for example you have in commoncontrols.exe.or attach comboc with listviews and images.



Replies:
Posted By: robs
Date Posted: 13 November 2003 at 9:38pm

peterhan, I'm not sure but I think you can only add these types of controls if you have the MFC version, not ActiveX. Take a look at http://www.codejock.com/products/compare/ - http://www.codejock.com/products/compare/

Good luck!



Posted By: robs
Date Posted: 04 December 2003 at 10:28pm

Peterhan,

It appears that 8.6 includes support for this.

Try something like this. Add a textbox named 'text1' to your form:

    Dim ToolBar As CommandBar    
    Set ToolBar = CommandBars.Add("Standard", xtpBarTop)
    With ToolBar.Controls
       Dim customControl As CommandBarControlCustom      
       Set customControl= .Add(xtpControlCustom, 999, "Test")
       customControl.Handle = Text1.hWnd

     End with

If you want to capture the click event, you'll have to add that manually. CommandBars_Execute won't catch the click of a custom control. You could obviously just use the click event of the textbox, or if you want to keep things clean, handling everything in the same place, try:

Private Sub Text1_Click()
  Dim CommandBarControl As ICommandBarControl
  Set CommandBarControl = CommandBars.FindControl(, 999)
  Call CommandBars_Execute(CommandBarControl)
End Sub

and then code like you normaly would:

Private Sub CommandBars_Execute(ByVal Control As XtremeCommandBars.ICommandBarControl)
    Select Case Control.Id
        Case 999: MsgBox "Test"
        Case ID_HELP_ABOUT:     MsgBox "Version " & App.Major ........

Good luck!

 



Posted By: gordongong
Date Posted: 26 February 2004 at 2:12pm

Hi,

this is cool, but it seems to me there is no way to control the size of "text1" within "customControl", correct?

well i am trying to use a xtpControlCustom control(attached to CommandBarPopup) to popup a form, and the only problem is i can't control the size of the form, is this true or am i doing something wrong?

 

thanks in advance!



Posted By: SuperMario
Date Posted: 26 February 2004 at 2:52pm

You can control the size of Text1.  Assuming you have a textbox control on your form called Text1.

    Text1.Width = 2000
    Dim ToolBar As CommandBar    
    Set ToolBar = CommandBars.Add("Standard", xtpBarTop)
    With ToolBar.Controls
       Dim customControl As CommandBarControlCustom      
       Set customControl= .Add(xtpControlCustom, 999, "Test")
       customControl.Handle = Text1.hWnd
     End with

You can just use the CommandBarEdit control to do the same thing, when using this control you can change the width at any time, not sure about the text box. 

About your other question, you would have to edit the size of the form before the form is attached just like setting the Text1.Width before the Custom control is attached.



Posted By: serkan
Date Posted: 23 March 2006 at 6:00pm

hi i also have a problem with the xtpControlCustom

Private Sub CommandBars_InitCommandsPopup(ByVal CommandBar As XtremeCommandBars.ICommandBar)

    If (CommandBar.Title = "Form") Then
        Dim ControlForm As CommandBarControlCustom
        CommandBar.Controls.DeleteAll
        Set ControlForm = CommandBar.Controls.Add(xtpControlCustom, 0, "Form")
        ControlForm.Handle = pboxForm.hWnd
       
        Exit Sub
    End If
End Sub

pboxForm has checkbox, textbox, button

all controls works but textbox not..

i can click it but i cant write any text in it..?

checkbox and button works fine.. but keybord is locked on textbox controls..

 



Posted By: serkan
Date Posted: 27 March 2006 at 5:18pm

i had 9.6 version and it has that bug.. v9.81 is working good.. now i downloaded 9.81

but now i have another problem.. i attached some forms (form2) to commandbar on form1, the form2 opened by the commandbar works good.

there are commandbars also on the form2 ..but when i click on an item on the commandbar on the form2, the form2  is closing automatically.. how can i stop closing? also i have a form3 opened by form2's commandbar, and happens on it also..

this happens also when a msgbox opened by form2..

 

 




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