Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > General Discussion
  New Posts New Posts RSS Feed - Forms attached to commandbar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forms attached to commandbar

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

Joined: 13 November 2003
Location: Greece
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote peterhan Quote  Post ReplyReply Direct Link To This Post Topic: Forms attached to commandbar
    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.
Back to Top
robs View Drop Down
Groupie
Groupie


Joined: 09 November 2003
Status: Offline
Points: 84
Post Options Post Options   Thanks (0) Thanks(0)   Quote robs Quote  Post ReplyReply Direct Link To This Post 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/

Good luck!

Back to Top
robs View Drop Down
Groupie
Groupie


Joined: 09 November 2003
Status: Offline
Points: 84
Post Options Post Options   Thanks (0) Thanks(0)   Quote robs Quote  Post ReplyReply Direct Link To This Post 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!

 

Back to Top
gordongong View Drop Down
Newbie
Newbie


Joined: 26 February 2004
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote gordongong Quote  Post ReplyReply Direct Link To This Post 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!

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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.



Edited by SuperMario
Back to Top
serkan View Drop Down
Newbie
Newbie


Joined: 23 March 2006
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote serkan Quote  Post ReplyReply Direct Link To This Post 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..

 

Back to Top
serkan View Drop Down
Newbie
Newbie


Joined: 23 March 2006
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote serkan Quote  Post ReplyReply Direct Link To This Post 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..

 

 

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.340 seconds.