| View previous topic :: View next topic |
| Author |
Message |
Evgenych General User

Joined: 03 Jan 2008 Posts: 9
|
Posted: Sat Mar 01, 2008 7:53 am Post subject: How to adapt form grid size to screen resolution? |
|
|
as example
| Code: |
oControl = thisComponent.CurrentController
oForm = ThisComponent.DrawPage.Forms.getByName("MainForm")
oGrid = oForm.getByName("MainForm_Grid")
oCtr = oControl.GetControl(oGrid)
aSize = createUnoStruct("com.sun.star.awt.Size")
aSize.width = 1280
aSize.height = 900
oCtr.setOutputSize(aSize) ' doesn't work
oCtr.setPosSize(0,20,1280,900,15) 'doesn't work
|
I read this post http://www.oooforum.org/forum/viewtopic.phtml?t=8410.
and don't understand how to apply it to my problem.
Can anybody help me? |
|
| Back to top |
|
 |
Evgenych General User

Joined: 03 Jan 2008 Posts: 9
|
Posted: Wed Mar 05, 2008 8:12 am Post subject: |
|
|
There are computers with 15 to 19 inch monitors in local network.
OpenOffice is front-end to mySql database.
On some computers grids are small, on other are big.
I want to find a way to stratch grid size to screen size.
Is anybody solve such problem?
p.s. my English is not good  |
|
| Back to top |
|
 |
Evgenych General User

Joined: 03 Jan 2008 Posts: 9
|
Posted: Mon Mar 17, 2008 11:30 am Post subject: |
|
|
| Code: |
sub adaptFormSize ()
oForm = thisComponent.drawPage.forms.getByName("MainForm")
oGridModel = oForm.getByName("MainForm_Grid")
oController = thisComponent.getCurrentController()
xGrid = oController.getControl(oGridModel)
oCompWindow = oController.frame.componentWindow
winPos = oCompWindow.accessibleContext.getAccessibleChild(0).getPosSize()
xGrid.setPosSize(-999, -999, winPos.width, winPos.height-30, 12) '"com.sun.star.awt.PosSize.WIDTH"
end sub
|
This work's.
But on "some events" grid size return to initial value.
I add 3 event listeners in which i call adaptFormSize() (mouseMotion to gridControl and formController.getContainer() and topWindowListener to container of current frame).
I want to find which "some events" make grid size to return.
I find that this happens
-after dissapearing of tooltip on FormNavigationBar button (only when bar docked to top)
-when floating navigation bar dragging over XGridContol border
(and xGridControl blinking (or rendering, don't know how to say) at this moment.)
-when window change state from max to normal and vice-versa
it is like event "repaint"
i try add paintListener to these event broadcasters:
oFrame.ContainerWindow (triggers on form open (only when FormNavigationBar is visible (insted of all bars are hidden)
oFrame.ComponentWindow (triggers on pressing F4 - View data source)
oFormController.container (nothing)
xGrid (nothing)
How does OpenOffice know it is time to revert xGridControl size to size specified in form designer??? |
|
| Back to top |
|
 |
Evgenych General User

Joined: 03 Jan 2008 Posts: 9
|
Posted: Sat Mar 22, 2008 8:33 am Post subject: |
|
|
| Code: |
xGrid.setPosSize(-999, -999, winPos.width, winPos.height-30, 12)
[b]thisComponent.lockControllers[/b]
|
This command prevent Grid from return to initial size, but some visual garbage appear on the screen on some circumstances. |
|
| Back to top |
|
 |
|