Bug 60117 - BASIC: oWindow.SetVisible not working WITH WINDOWS
Summary: BASIC: oWindow.SetVisible not working WITH WINDOWS
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.0.0.2 rc
Hardware: All Windows (All)
: medium minor
Assignee: Noel Power
URL:
Whiteboard: BSA target:4.1.0 target:4.0.1
Keywords: regression
: 60878 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-01-31 11:56 UTC by Fernand
Modified: 2013-03-22 10:12 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fernand 2013-01-31 11:56:34 UTC
Problem description: 

Steps to reproduce:
1. RUN the macro code lines....
2. ....
3. ....

Current behavior:no Window is visible

Expected behavior: visible empty Window

              
Operating System: Windows XP
Version: 4.0.0.2 rc
Last worked in: 3.6.4.3 release
Comment 1 Fernand 2013-01-31 12:04:45 UTC
the code below was confirmed to work still for Fedora and Linux 
but not for Windows sinds 4.0

"oWindow.setVisible(True)" is failing

Sub Main
  oDoc = ThisComponent
  oParentFrame = oDoc.CurrentController.Frame
  oPeer = oParentFrame.ContainerWindow
  oToolkit = oPeer.Toolkit
  
  oWindow = CreateNewWindow(oToolkit,oPeer,150,150,200,200)
  oFrame = CreateUnoService("com.sun.star.frame.Frame")
  oFrame.initialize(oWindow)
  oFrame.setCreator(oParentFrame)
  oFrame.setName("NewFrame")
  oFrame.Title = "New Frame"
  
  oParentFrame.getFrames().append(oFrame)
  
  oWindow.setVisible(True)
End Sub


Function CreateNewWindow( _
  oToolkit,oParent,nX,nY,nWidth,nHeight) As Object
  aRect = CreateUnoStruct("com.sun.star.awt.Rectangle")
  With aRect
    .X = nX
    .Y = nY
    .Width = nWidth
    .Height = nHeight
  End With
  aWinDesc = CreateUnoStruct("com.sun.star.awt.WindowDescriptor")
  With aWinDesc
    .Type = com.sun.star.awt.WindowClass.TOP
    .WindowServiceName = "dialog"
    .ParentIndex = -1
    .Bounds = aRect
    .Parent = oParent
    .WindowAttributes = _
      com.sun.star.awt.WindowAttribute.MOVEABLE + _
      com.sun.star.awt.WindowAttribute.CLOSEABLE
  End With
  CreateNewWindow = oToolkit.createWindow(aWinDesc)
End Function
Comment 2 headsup 2013-02-01 23:14:28 UTC
Thanks for reporting this I was able to confirm it. The Basic Macro seems to work correctly on 3.6.5.2 (see attached screenshot). 

I get no reaction at all on 4.0.0.2. 

Tested on W8 Pro 32 bit, Libreoffice Version 4.0.0.2 .0.2 (Build ID: 5991f37846fc3763493029c4958b57282c2597e).

I am initially classifying this as minor / medium - requires users not to use some features as per following flow..

https://wiki.documentfoundation.org/images/0/06/Prioritizing_Bugs_Flowchart.jpg
Comment 3 Noel Power 2013-02-07 12:40:19 UTC
interesting, it seems that the position and size seem to be corrupted/changed, it is possible though workaround the problem bet resetting again the window possize

like

  oWindow.setVisible(True)
  flags = com.sun.star.awt.PosSize.POSSIZE
  oWindow.setPosSize( 150,150,200,200, flags)

don't know why this doesn't happen on linux ( maybe it actually does but just not as badly ) or even when the size/pos is changed. I will try to find out, I will take this bug for a while and see if I can get further, if not I will push back to the list
Comment 4 Caolán McNamara 2013-02-08 14:36:47 UTC
Yeah, it happens under Linux too that the embedded rectangle struct inside the WindowDescriptor struct is passed through uno with zeroed out values, its just that the linux-specific code applies a default size to the dialog them
Comment 5 Noel Power 2013-02-08 17:31:52 UTC
so, nearly there, I just need to pimp up the basic tests to try and catch any other 'funnies' with this. Ironically this was caused by a change to basic to make it do what you would 'expect' when modifying nested basic structs ( that themselves contain a struct )... the patch nastily made basic internally think that such modifications worked as expected but unfortunately when the basic object was exposed to the outside world ( e.g. over uno ) it turns out in fact it hadn't been modified as expected. Worse even looking at the object in the watch window and it looked like the nested struct was populated ( reminds me that's another thing to check ) see bug #47263  ( and the associated guilt commit http://cgit.freedesktop.org/libreoffice/core/commit/?id=1720641bf36306fc296635925e571556ced8a302 ) for more details
Comment 6 Not Assigned 2013-02-11 12:25:54 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6865445a5ec90b49c5fde58531def4b9a64f26e8

fix basic access to nested uno structures fdo#60117



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 7 Noel Power 2013-02-11 13:16:53 UTC
review requested also for 4-0 branch, please see

https://gerrit.libreoffice.org/#/c/2099/
Comment 8 Not Assigned 2013-02-18 12:05:55 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a8de73a911c03b518abffcaeba871672159d2ce4&h=libreoffice-4-0

fix basic access to nested uno structures fdo#60117


It will be available in LibreOffice 4.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 Noel Power 2013-03-22 10:12:01 UTC
*** Bug 60878 has been marked as a duplicate of this bug. ***