| View previous topic :: View next topic |
| Author |
Message |
Micah Guest
|
Posted: Mon May 12, 2003 9:41 am Post subject: Help creating forms for a database front-end |
|
|
Hi, I'm making a database front-end using open office and starbasic (an experiment in Access replacement...) and cannot figure out how to set the focus on specific controls. Does anyone have any code for this?
I suppose as long as I'm writing a post, I'll ask a question about documentation as well. Currently, in order to figure out just what an object (err, service) is capable of, I use dbg_methods/properties and dump the results to emacs. This is the only way I have found to see all of the methods and properties of an object in one place. Is there any documentation or reference that is set up in a similar format, which allows me to quickly browse through exposed methods and properties on a per-service basis?
Thanks! |
|
| Back to top |
|
 |
cwchia Super User


Joined: 09 Jan 2003 Posts: 1050 Location: Malaysia
|
Posted: Mon May 12, 2003 10:08 pm Post subject: Re: Help creating forms for a database front-end |
|
|
| Micah wrote: | | Hi, I'm making a database front-end using open office and starbasic (an experiment in Access replacement...) and cannot figure out how to set the focus on specific controls. Does anyone have any code for this? |
I know nuts of starbasic but the following issue filed with OOo may be useful here...
http://www.openoffice.org/project/www/issues/show_bug.cgi?id=12434
Please share your experience in trying to replace Access. I have tried using OOo+MySQL on both Win98 and Linux and have concluded that it is surely not for casual user like me. I really hope that the developers for OOo to focus on getting the conectivity issue resolved with one of the many open source cross-platform databases like MySQL or Firebird etc then only to explore the connectivity with other databases. |
|
| Back to top |
|
 |
micahmason Newbie

Joined: 12 May 2003 Posts: 1 Location: Chicago, IL
|
Posted: Fri May 16, 2003 9:45 am Post subject: |
|
|
Well, I've got a front end up and running using OO1.1beta on redhat 8.0. It connects to a local MySQL 4.0 through UnixODBC + MyODBC. I put it into a Calc sheet so that I can have multiple forms for the users to see (i.e sheet one is for contacts, sheet two is for agencies, sheet three will be inventory). Since I couldn't find a tab control to allow me to have all forms on one page, I did it this way, and it works well.
Today my teammate and I are going to attempt to access the database across the network, and next week we'll be getting it to work on both the win2k machines and redhat machines. I was planning to write up the results on what it took to get this done. I can post that here as well.
So far, I agree, OO as an access replacement is not for the casual user. After we get this all working, I'm going to write-up my results and see if its not possible to get a fairly straight-forward How-to document that details how to do it. I think its getting close. The one thing I would like to be able to do is build interfaces to one-to-many relationships with no coding. Its easy enough to build a query to do it, but if you want to link a query to your current record you need to use named arguments, and added rows to the many table requires coding (as far as i could figure it anyway). If this could be solved that would make OO much more suitable for small databases. Admittedly I don't know much about foreign keys and did not implement them, so that may be the problem here.
Alas, the issue you showed me doesn't mention how to set the focus to a control programmatically. if you know how to do that, thats the last thing I need to do to pretty-up my interfaces. Thanks! |
|
| Back to top |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1605 Location: Wellington, New Zealand
|
Posted: Fri May 16, 2003 4:40 pm Post subject: |
|
|
Have a look at the developers guide with the sdk:
OpenOffice.org1.0.2_Beta_SDK/docs/DevelopersGuide/Forms/Forms.htm#1+1+Introduction
This has a section on focussing the controls.
I built a contact management system using OOo forms and mySQL. Supporting the one-many relationships with form and sub-form components was simple enough once I had got the knack of using the forms editor. This did all the forms navigation stuff, inserts and deletions. The only coding I did was around some button events to change the filter property on the form which operates like a roladex (click B and it lists clients begining with B).
I look forward to your 'how to ... '. There is a documentation project on OOo which could find a home for that and save the rest of us hacking in the dark. |
|
| Back to top |
|
 |
cwchia Super User


Joined: 09 Jan 2003 Posts: 1050 Location: Malaysia
|
Posted: Mon May 19, 2003 1:45 am Post subject: |
|
|
| dfrench wrote: | | I look forward to your 'how to ... '. There is a documentation project on OOo which could find a home for that and save the rest of us hacking in the dark. |
Yeah, a shepherd is alwasys welcome  |
|
| Back to top |
|
 |
thingkcp Newbie

Joined: 04 Jun 2003 Posts: 2
|
Posted: Tue Jun 24, 2003 12:28 am Post subject: Setting focus to control |
|
|
| Micah wrote: | Hi, I'm making a database front-end using open office and starbasic (an experiment in Access replacement...) and cannot figure out how to set the focus on specific controls. Does anyone have any code for this?
|
I've just worked out how to do this and I am so pleased I couldn't wait to share it with you.
The secret is in the fact that, as with documents and forms, controls have a 'model' and a 'view'. Normally when you select a control in a macro you select the 'model', and this enables you to change things like the value of the control. To set the focus you have to work with the 'view' - with this you can also do things like make the control invisible.
So, if you have a form with a control named 'ControlName', then something like this should work:
Sub SetFocusToControlName
Dim oDoc, oForm, oController
Dim cControl, oControlView
oController = ThisComponent.CurrentController
oDoc = ThisComponent.CurrentController.Frame
oForm = ThisComponent.drawpage.forms.GetByName("Standard")
rem This assumes that the form has the default name "Standard"
cControl = oForm.GetByName("ControlName")
rem this is the control model
oControlView = oController.GetControl(cControl)
rem this is the control view - the object you want to work with
oControlView.SetFocus
rem that should do the job
End Sub
This is adapted from the code I have used on my own form, so I am not sure it will work exactly as written, but I'm sure you get the idea. I'm using OpenOffice.org version 1.1 beta2, by the way - I don't know if this works with earlier versions.
If you look in the macros supplied with the program there are lots of useful nuggets. I worked this out after looking at the macro 'getControlView' which is in Tools/Module Controls.
Hope that helps.
Þing |
|
| Back to top |
|
 |
|
|
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
|