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

Joined: 08 Dec 2008 Posts: 8
|
Posted: Mon Jan 31, 2011 12:18 pm Post subject: How can I hide the main application window Base? |
|
|
I want to hide from the user's main application window.
The main menu of my database is in the form of a "Menu".
Form is launched in another window, and only these window must be visible to the user. |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
|
| Back to top |
|
 |
GrzegorzJ General User

Joined: 08 Dec 2008 Posts: 8
|
Posted: Mon Jan 31, 2011 12:48 pm Post subject: How can I hide the main application window Base? |
|
|
| Villeroy wrote: | | http://www.oooforum.org/forum/viewtopic.phtml?t=38329 |
I tried this method. But in my case the code does not work with the button that launches another form of data if you do not run the main application window.
Looking for another way.
My "Menu" form contains only the keys that open other forms of data.
I created a shortcut that contains the entry:
"C:\Program Files (x86)\OpenOffice.org 3\program\soffice.exe" "D:\Sawol\Sawol.odb" "macro:///Sawol.Global.OpenWinLog()"
| Code: |
Public Sub OpenWinLog()
Dim Context AS Object
Dim DB As Object
Dim FormDoc As Object
Dim Args(1) As New com.sun.star.beans.PropertyValue
Rem... to check if the form is already loaded, so don't accidently do it twice.
oEnum = Stardesktop.Components().createEnumeration
oDesk = CreateUnoService("com.sun.star.frame.Desktop")
oEnum = oDesk.Components().createEnumeration
while oEnum.hasMoreElements
oComp = oEnum.nextElement
if HasUnoInterfaces(oComp, "com.sun.star.frame.XModule") then
if oComp.Identifier = "com.sun.star.sdb.FormDesign" then
if left(oComp.CurrentController.Frame.Title, len("Menu")) = "Menu" then
ContKli=ThisComponent.CurrentController.Frame.ContainerWindow
oComp.GetCurrentController().GetFrame().GetContainerWindow().setFocus()
msgbox "Baza jest już otwarta!"
exit sub
endif
endif
endif
wend
Context=CreateUnoService("com.sun.star.sdb.DatabaseContext")
DB=Context.getByName("Sawol") REM YOUR DB NAME
ConnGB=DB.getconnection("user","passwort")
Args(0).Name="ActiveConnection" : Args(0).Value=ConnGB
Args(1).Name="OpenMode" : Args(1).Value="open"
FormDoc=DB.DatabaseDocument.FormDocuments.loadComponentFromURL("Menu","_self",2,Args)
If isNull (thiscomponent.CurrentController.Frame.Creator) then
oFormFrame = FormDoc.getCurrentController().getFrame()
StarDesktop.getFrames().append(oFormFrame)
End if
End Sub
|
This approach allows for the implementation of procedures to open forms
| Code: |
Sub OpenWindow (parForm as string)
Dim vForm, Cont, NewCont As Object
OpenForm(getFormsTC, getConnectionTC, parForm)
NewCont=ThisComponent.CurrentController.Frame.ContainerWindow
NewCont.setFocus()
End Sub
function OpenForm( formContainer as variant, oConnection as variant, sFormName as string) as variant
Dim aProp(1) As New com.sun.star.beans.PropertyValue
aProp(0).Name = "ActiveConnection"
aProp(0).Value = oConnection
aProp(1).Name = "OpenMode"
aProp(1).Value = "open"
OpenForm = formContainer.loadComponentFromURL(sFormName,"_blank",0,aProp())
end function
function getFormsTC() as variant
getFormsTC = thisComponent.Parent.getFormDocuments
end function
function getConnectionTC() as variant
getConnectionTC = thisComponent.Drawpage.Forms(0).ActiveConnection
end function
|
It works but I see the main database.
If I change the shortcut to the following:
"C: \ Program Files (x86) \ OpenOffice.org 3 \ program \ soffice.exe" "macro: / / / Sawol.Global.OpenWinLog ()"
Only opens up the form at the moment (without the main window) and immediately closes.
Previous versions of OpenOffice form will not closes if he was running quickstart. I currently have version 3.2.1. and the problem is.
Link to a similar topic http://www.oooforum.org/forum/viewtopic.phtml?t=75209&highlight=shortcut
Last edited by GrzegorzJ on Mon Jan 31, 2011 2:53 pm; edited 3 times in total |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Mon Jan 31, 2011 1:40 pm Post subject: |
|
|
You don't need any code. Simply store your forms as normal documents in Writer or use the tabbed interface of a Calc document.
Then you can call your forms by means of desktop links and ordinary hyperlink buttons. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
GrzegorzJ General User

Joined: 08 Dec 2008 Posts: 8
|
Posted: Mon Jan 31, 2011 2:38 pm Post subject: |
|
|
| Villeroy wrote: | You don't need any code. Simply store your forms as normal documents in Writer or use the tabbed interface of a Calc document.
Then you can call your forms by means of desktop links and ordinary hyperlink buttons. |
I can not save each form separately because they are generated, depending on the filter in the first form, andsubsequent forms often include a filter for the next child forms .
This method is too rigid for my needs. |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Wed Feb 02, 2011 3:15 am Post subject: |
|
|
| Quote: | | I can not save each form separately because they are generated, depending on the filter in the first form, andsubsequent forms often include a filter for the next child forms . |
And this is no obstacle neither if you would organize this entirely through SQL rather than Basic.
Anyhow, there are dozends of macros in this forum alone to open forms and apply filters to them. Search for single word OpenForm and you get 100 hits, mostly in the Base forum. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
GrzegorzJ General User

Joined: 08 Dec 2008 Posts: 8
|
Posted: Wed Feb 02, 2011 9:32 am Post subject: How can I hide the main application window Base? |
|
|
| Villeroy wrote: | | Quote: | | I can not save each form separately because they are generated, depending on the filter in the first form, andsubsequent forms often include a filter for the next child forms . |
And this is no obstacle neither if you would organize this entirely through SQL rather than Basic.
Anyhow, there are dozends of macros in this forum alone to open forms and apply filters to them. Search for single word OpenForm and you get 100 hits, mostly in the Base forum. |
I recall a question. How can I hide the main application window Base?
So I'm in the right section. I know that the API can do it. I need to find the window handle to hide and
ShowWindow WinWnd, par ' par = 0-hide, 1-resize , 2-Min, 3-Max
Do you know how I can find the handle to the main window? |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Wed Feb 02, 2011 11:49 am Post subject: |
|
|
You refer to the WIndows API. OOo is platform independent. You may use a serious programming language instead of Basic or look up "Declare" in the Basic help which is a WIndows-only feature.
Meanwhile I run several partially interdependent forms (Writer) and reports (pivot tables in Calc) without Base Window and without writing a single line of code. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
GrzegorzJ General User

Joined: 08 Dec 2008 Posts: 8
|
Posted: Wed Feb 02, 2011 1:30 pm Post subject: |
|
|
| Villeroy wrote: | You refer to the WIndows API. OOo is platform independent. You may use a serious programming language instead of Basic or look up "Declare" in the Basic help which is a WIndows-only feature.
Meanwhile I run several partially interdependent forms (Writer) and reports (pivot tables in Calc) without Base Window and without writing a single line of code. |
I'm looking for the simplest solution for my needs. I'm sorry, but your solution does not work in my database. It'll be easier as you walk in my line of reasoning. I have something like that.
| Code: |
Private Declare Function FindWindow Lib "user32"Alias "FindWindow" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_NORMAL = 1
Private Const SW_MAXIMIZE = 3
Private Const SW_MINIMIZE = 6
Private Const SW_RESTORE = 9
|
and procedure, which works in Excel
| Code: |
Sub HideWindow
Dim Pusty As String
hinst = FindWindow (Pusty, "Sawol.odb - OpenOffice.org Base")
'OR hinst = FindWindow (vbNullString, "Sawol.odb - OpenOffice.org Base") Only Excel
If Not IsNull (hinst) Then
ShowWindow hinst, SW_HIDE
End If
End Sub
|
But does not work in the Open. I do not know why. |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
|
| Back to top |
|
 |
|