Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Attach custom form to  toolbar button
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Attach custom form to toolbar button

 Post Reply Post Reply
Author
Message
daliaessam View Drop Down
Newbie
Newbie


Joined: 28 June 2005
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote daliaessam Quote  Post ReplyReply Direct Link To This Post Topic: Attach custom form to toolbar button
    Posted: 28 June 2005 at 3:14pm

Hello,

I just purchased the ActiveX suite and I am happy realy with everything except for the docs.

I need to attach a form to a toolbar button and be able to resize it after the form is displayed, What I am trying to do is exactly as the Insert Table button on MS Frontpage do, that's when I click on the inert table button, it displays the form and if the user drags the mouse I can resize it.

This is an MDI project, I see in some sample you did something with a picture box.

Please drive me.

Thanks everyone

 



Edited by daliaessam
Back to Top
daliaessam View Drop Down
Newbie
Newbie


Joined: 28 June 2005
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote daliaessam Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2005 at 7:50am

Here is what I tried based on your sample:

        Dim ControlTableBox As CommandBarPopup
        Set ControlTableBox = .Add(xtpControlButtonPopup, ID_Table_InsertTable, "Insert Table")
        ControlTableBox.CommandBar.SetPopupToolBar True
        ControlTableBox.CommandBar.Title = "InsertTable"

Private Sub CommandBars_InitCommandsPopup(ByVal CommandBar As XtremeCommandBars.ICommandBar)

    Dim formTableBox As New frmTableBox
   
    If (CommandBar.Title = "InsertTable") Then
        Dim ControlForm As CommandBarControlCustom
        CommandBar.Controls.DeleteAll
        Set ControlForm = CommandBar.Controls.Add(xtpControlCustom, 0, "InsertTable")
        ControlForm.Handle = formTableBox.hwnd
        formTableBox.BackColor = CommandBars.GetSpecialColor(XPCOLOR_MENUBAR_FACE)
        
        Exit Sub
    End If

End Sub

and frmTableBox is a form with a picture box Picture1:

Option Explicit

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

    Me.Width = Me.Width + 60
    Picture1.Width = Picture1.Width + 60
    Picture1.Height = Picture1.Height + 60

End Sub

The popup control seems to set its width, height from the form before display, now the question is, how do I change the control with, height to fit the form after I resize it.

Is there a .Width and .height to resize the opened popup or what Iam doing wrong.


 



Edited by daliaessam
Back to Top
daliaessam View Drop Down
Newbie
Newbie


Joined: 28 June 2005
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote daliaessam Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2005 at 5:30pm

Joke Support,

Why you are not answering this email and the ticked I sent.

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: 04 July 2005 at 3:11am

Hi, Sorry, there were some vacations...

 

Try this trick:

1. Add member of frmTableBox

Public ControlForm As CommandBarControlCustom

2. Save it in CommandBars_InitCommandsPopup

...

ControlForm.Handle = formTableBox.hWnd
Set formTableBox.ControlForm = ControlForm

 

3.

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

    Picture1.Width = Picture1.Width + 60
    Picture1.Height = Picture1.Height + 60
    Me.Width = Me.Width + 60
    Me.Height = Me.Height + 60
  

    ControlForm.Handle = Me.hWnd
    Set TempControl = ControlForm.Parent.Controls.Add(xtpControlButton, 1, "")
    TempControl.Delete
End Sub

 

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