Hi

The following macro creates a simple window with a title. OOo 2.4.1 shows the 
title normally, while OOo 3.1.1 seems to ignore it. Does anyone know what's 
wrong ?


Thanks


Option Explicit

Sub Main
Dim oNewFrame As Object
Dim oNewWindow As Object
  oNewWindow = CreateWindow( GetToolkit, MakeRect(50,50,250,150) )
  oNewFrame = CreateNewFrame( oNewWindow, "New Frame" )
  oNewFrame.setPropertyValue("Title","title")
  StarDesktop.getFrames().append(oNewFrame)
  Exit Sub
End Sub


Function GetToolkit()
  GetToolkit = GetProcessServiceManager. _
    createInstanceWithContext( _
    "com.sun.star.awt.Toolkit",GetDefaultContext)
End Function


Function CreateNewFrame( oLocWindow As Object, _
    sLocFrameName As String ) As Object
Dim oLocNewFrame As Object
  oLocNewFrame = 
GetProcessServiceManager.createInstance("com.sun.star.frame.Frame")
  With oLocNewFrame
    .initialize(oLocWindow)
    .setCreator(StarDesktop)
    .setName(sLocFrameName)
  End With
  CreateNewFrame = oLocNewFrame
End Function


Function CreateWindow( oLocToolkit As Object, _
  aLocRect As com.sun.star.awt.Rectangle ) As 
com.sun.star.awt.WindowDescriptor
Dim oLocWinDesc
  oLocWinDesc = createUnoStruct("com.sun.star.awt.WindowDescriptor")
  With oLocWinDesc
    .Type = com.sun.star.awt.WindowClass.TOP
    .Bounds = aLocRect
  End With
  With com.sun.star.awt.WindowAttribute
    oLocWinDesc.WindowAttributes = _
      .MOVEABLE + .CLOSEABLE + .BORDER + .SHOW + .SIZEABLE
  End With
  CreateWindow = oLocToolkit.createWindow(oLocWinDesc)
End Function


Function MakeRect( nX As Long, nY As Long, _
  nWidth As Long, nHeight As Long ) As com.sun.star.awt.Rectangle
Dim oLocRect
  oLocRect = createUnoStruct("com.sun.star.awt.Rectangle")
  With oLocRect
    .X = nX
    .Y = nY
    .Width = nWidth
    .Height = nHeight
  End With
  MakeRect() = oLocRect
End Function 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to