Print Page | Close Window

Attach custom form to toolbar button

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=2470
Printed Date: 07 July 2024 at 6:39pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Attach custom form to toolbar button
Posted By: daliaessam
Subject: Attach custom form to toolbar button
Date 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

 




Replies:
Posted By: daliaessam
Date 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.


 



Posted By: daliaessam
Date Posted: 29 June 2005 at 5:30pm

Joke Support,

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



Posted By: Oleg
Date 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



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