OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to adapt form grid size to screen resolution?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
Evgenych
General User
General User


Joined: 03 Jan 2008
Posts: 9

PostPosted: Sat Mar 01, 2008 7:53 am    Post subject: How to adapt form grid size to screen resolution? Reply with quote

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
View user's profile Send private message
Evgenych
General User
General User


Joined: 03 Jan 2008
Posts: 9

PostPosted: Wed Mar 05, 2008 8:12 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Evgenych
General User
General User


Joined: 03 Jan 2008
Posts: 9

PostPosted: Mon Mar 17, 2008 11:30 am    Post subject: Reply with quote

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
View user's profile Send private message
Evgenych
General User
General User


Joined: 03 Jan 2008
Posts: 9

PostPosted: Sat Mar 22, 2008 8:33 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group