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

loading forms

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


Joined: 04 Jun 2009
Posts: 26

PostPosted: Sat Jun 20, 2009 7:51 am    Post subject: loading forms Reply with quote

Hi guys,

I have a MySQL database running through base.

I have a main form with buttons that use the macro below to load other forms.

sub load_support
dim oCurrentController
'Variables for document what will be opened
dim sNewfileFormName ' This is the name how it is in the database
dim oNewformtoSee ' Object for the new form what will beopend
sNewfileFormName="customersupport" 'is a writer form it must be in this database

'ThisDatabaseDocument 'ThisDatabaseDocument is a new constant in OOO3.0
oCurrentController=ThisDatabaseDocument.CurrentController

if ThisDatabaseDocument.FormDocuments.hasbyname(sNewfileFormName) then
' the form exist and can maybe opend
oNewformtoSee=oCurrentController.loadComponent( com.sun.star.sdb.application.DatabaseObject.FORM,sNewfileFormName,FALSE) ' or TRUE for editing the documentwait 10
else
msgbox "The does not exist and cannot be opend"
end
end if
End Sub

When the form loads it is nearly the full size of the screen, but not the maximum size... is there an easy way to get it to load all forms as maximum size?

Each other form has a button to return to the main menu which uses the same macro as above to load the main menu, is their a way to get it to close the form that is currently loaded before returning to the main form?

Thanks in advance!

James
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2697
Location: Apeldoorn, Netherland

PostPosted: Sat Jun 20, 2009 9:59 am    Post subject: Reply with quote

Hello


Fullscreen is real common on this forum. You ask more for maxscreen. I don't know. Maybe you are satisfied with link for fullscreen
http://www.oooforum.org/forum/viewtopic.phtml?t=79049&highlight=fullscreen+sub

Romke
Back to top
View user's profile Send private message
jmckay
General User
General User


Joined: 04 Jun 2009
Posts: 26

PostPosted: Sun Jun 21, 2009 10:43 am    Post subject: Reply with quote

Hi,

I have followed the instructions above, the odb file loads in full screen but when I load forms they don't load the size of the screen? Any suggestions?

Thanks,
James
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2697
Location: Apeldoorn, Netherland

PostPosted: Sun Jun 21, 2009 11:21 am    Post subject: Reply with quote

Hello

On this moment openform and closedoc is changing from version to version. But the direction is good.

I do add some code but it is only complete useful for OOo3.1 but some part can be used in older version.

The sub cover form takes the values from the form who opens the new. and place the new on the same as the old form only on top

Do you know switchboard from Benitez?

Romke

Code:
function openform (sNewFormName) as object
' Give the name of the form you want open.
' It will only work with OO03.1 or higher
'Don't be scared of this long sub.
' Most is for testing if all things are good
dim oNewForm ' This object is for subdocument.
dim oNewFormopen ' This is the text document. Now you can reach the forms and the controls
' Test if your version of OOo is capabel for this code
if  GetSolarVersion < 310 then
   print "Your version of OpenOffice to old for this code"
   end
end if
' Go for the object of the subdocument
if  ThisDatabaseDocument.FormDocuments.hasbyname(sNewFormName) then
      oNewForm=ThisDatabaseDocument.FormDocuments.getbyname(sNewFormName)
   else
       Print "This database does not have a form with this name"
       end
end if

if not HasUnoInterfaces(oNewForm,"com.sun.star.sdb.XSubDocument") then
   ' It is possible that you use a mapname and this is not good working
   ' for that reason I did not work it out.
   msgbox "Your version of Open Office does not have this capabillities" & chr(13) _
   & "The program will stop"
   end
end if

' All things are tested and good open the form
openform=oNewForm.open ' This give also back an object with is the same as thiscomponent
end function

sub CoverForm
' This must make cover the window from one form with the new form.
' Also the form is opend
dim oForm
dim  aSizeWindow as new com.sun.star.awt.Rectangle ' Make a special variable
'Be sure your windows is maxwindow
aSizeWindow=thiscomponent.CurrentController.Frame.ContainerWindow.getPosSize
with aGetSizeWindow
    'print .x,.y,.width,.height
end with
oForm=openform("dubbelinput") 'Put in the name you want open
oForm.CurrentController.Frame.ContainerWindow.setPosSize( aSizeWindow.x,aSizeWindow.y,aSizeWindow.width,aSizeWindow.height,15)
'The last value=15 that are only flags
'oWindow.setPosSize(0,0,250,250,15)
'http://api.openoffice.org/docs/common/ref/com/sun/star/awt/PosSize.html
end sub
Back to top
View user's profile Send private message
jmckay
General User
General User


Joined: 04 Jun 2009
Posts: 26

PostPosted: Sun Jun 21, 2009 2:12 pm    Post subject: Reply with quote

Thanks for the reply.

I'm a little unsure as to where I should replace the form name? is this the full code?

Help apprciated...

Am I right in thinking this will load in the form in max screen size, and also close the current form when I press a button to open another one (the main menu)?

Thanks
James


Last edited by jmckay on Sun Jun 21, 2009 3:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2697
Location: Apeldoorn, Netherland

PostPosted: Sun Jun 21, 2009 3:14 pm    Post subject: Reply with quote

Hello

Every form must be processed and made to the size you want have.
You can made for every form a macro or you give the macro the name as parameter of the form you want have processed. It is to you.

Try to understand this macros and organize them in a way you want have them.
Two things are important
a) the macro must knew to which form it belong. It belongs to the calling component. The reason is thiscomponent.
b) the macro must knew what is the new form.

Try to play with this code and erase some stuff what is a rest of testing. Playing with new code is always a good methode for learning.

In the code I did add explanations and testing. This all for for better uderstanding for other people.
Adjust all those thing in a way you can understand it.

It is also possible for you not to use this code then you have to process full screen for every form as this code you have to proceed on every form.

I hope this helps you
Romke
Back to top
View user's profile Send private message
jmckay
General User
General User


Joined: 04 Jun 2009
Posts: 26

PostPosted: Sun Jun 21, 2009 5:06 pm    Post subject: Reply with quote

Again thanks for your reply... but I'm getting errors while running this.

Can you point out exactly where I put the form name? Do I only need to enter it once?

I am really sorry... trying hard just struggling a little - I spent a while earlier looking over the code.

Thanks
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