by m42i » Fri Apr 05, 2013 9:47 am
I've got a persistent dockable panel with some elements inside. When I resize the panel those elements won't resize with them.
Here is my sample code. When I resize the PanelX, the ActiveX control inside won't resize with it.
https://dl.dropbox.com/u/344000/Demo.mmip
Code: Select all
' Demo file for resizing a persistent dockable panel
Const BTN_MARGIN = 5 ' Defines the standard margin between buttons
Const BTN_HEIGHT = 25 ' Defines standard height of a button
Const BTN_WIDTH = 80 ' Defines standard width of a button
Const TIME_WIDTH = 50 ' Defines standard width of a time label
Dim PanelX
Sub OnStartUp
Call CreateMainPanel
End Sub
Sub DoClick
SDB.MessageBox "Hello!", mtInformation, Array(mbOk)
End Sub
Sub CreateMainPanel
Set UI = SDB.UI
Set PanelX = UI.NewDockablePersistentPanel("PanelX")
If PanelX.IsNew Then
PanelX.DockedTo = 4
End If
PanelX.ShowCaption = True
PanelX.Common.Visible = True
Set ButtonA = UI.NewButton(PanelX)
Set SDB.Objects("ButtonA") = ButtonA
ButtonA.Common.Visible = True
ButtonA.Common.ControlName = "ButtonA"
ButtonA.Caption = SDB.Localize("Play")
ButtonA.Common.SetRect BTN_MARGIN, BTN_MARGIN, BTN_WIDTH, BTN_HEIGHT
Script.RegisterEvent ButtonA, "OnClick", "DoClick"
Set WebPanel = UI.NewActiveX(PanelX, "Shell.Explorer")
Set SDB.Objects("WebPanel") = WebPanel
WebPanel.Common.Visible = True
WebPanel.Common.ControlName = "WebPanel"
WebPanel.Common.Align = 0
WebPanel.Interf.Navigate "about:" ' A trick to make sure document exists, from Wiki
WebPanel.Common.SetClientRect BTN_MARGIN, 2*BTN_MARGIN + BTN_HEIGHT, _
PanelX.Common.Width - 3*BTN_MARGIN, _
PanelX.Common.Height - 4*BTN_MARGIN - 2*BTN_HEIGHT
End Sub
Sub Uninstall
PanelX.Common.Visible = False
Set PanelX = Nothing
Set SDB.Objects("PanelX") = Nothing
Script.UnRegisterEvents SDB
End Sub
I've got a persistent dockable panel with some elements inside. When I resize the panel those elements won't resize with them.
Here is my sample code. When I resize the PanelX, the ActiveX control inside won't resize with it.
https://dl.dropbox.com/u/344000/Demo.mmip
[code]
' Demo file for resizing a persistent dockable panel
Const BTN_MARGIN = 5 ' Defines the standard margin between buttons
Const BTN_HEIGHT = 25 ' Defines standard height of a button
Const BTN_WIDTH = 80 ' Defines standard width of a button
Const TIME_WIDTH = 50 ' Defines standard width of a time label
Dim PanelX
Sub OnStartUp
Call CreateMainPanel
End Sub
Sub DoClick
SDB.MessageBox "Hello!", mtInformation, Array(mbOk)
End Sub
Sub CreateMainPanel
Set UI = SDB.UI
Set PanelX = UI.NewDockablePersistentPanel("PanelX")
If PanelX.IsNew Then
PanelX.DockedTo = 4
End If
PanelX.ShowCaption = True
PanelX.Common.Visible = True
Set ButtonA = UI.NewButton(PanelX)
Set SDB.Objects("ButtonA") = ButtonA
ButtonA.Common.Visible = True
ButtonA.Common.ControlName = "ButtonA"
ButtonA.Caption = SDB.Localize("Play")
ButtonA.Common.SetRect BTN_MARGIN, BTN_MARGIN, BTN_WIDTH, BTN_HEIGHT
Script.RegisterEvent ButtonA, "OnClick", "DoClick"
Set WebPanel = UI.NewActiveX(PanelX, "Shell.Explorer")
Set SDB.Objects("WebPanel") = WebPanel
WebPanel.Common.Visible = True
WebPanel.Common.ControlName = "WebPanel"
WebPanel.Common.Align = 0
WebPanel.Interf.Navigate "about:" ' A trick to make sure document exists, from Wiki
WebPanel.Common.SetClientRect BTN_MARGIN, 2*BTN_MARGIN + BTN_HEIGHT, _
PanelX.Common.Width - 3*BTN_MARGIN, _
PanelX.Common.Height - 4*BTN_MARGIN - 2*BTN_HEIGHT
End Sub
Sub Uninstall
PanelX.Common.Visible = False
Set PanelX = Nothing
Set SDB.Objects("PanelX") = Nothing
Script.UnRegisterEvents SDB
End Sub
[/code]