Friday, 25 Sep 2009
Friday, 25 Sep 2009
As almost every extension developer knows the UNO AWT API is the only way to create native OpenOffice.org dialogs without using VCL (thus, C++) and link against native OOo libraries. Unfortunately, OpenOffice.org UNO AWT API is missing some complex controls. That's why we started implementing one of this missing features - Grid Control. It displays data in rows and columns, which can give a dialog a more sophisticated look. With the new Grid Control we like to make the daily work of an extension developer a little bit easier.
We like to invite you to give feedback and comments on the work we have done so far. First version with a small (and being far away from complete) but working feature set control is available with the DEV300 m59 developer snapshot OOo and SDK. Details and a sample code for the control can be found here:http://wiki.services.openoffice.org/wiki/API/UNO_AWT/Grid_Control
Note: Although the implementation of the control has not yet finished (several features are still missing), all available functionality has been tested carefully and should be usable as it is today. Your feedback is greatly appreciated.
tags: openoffige.org
Comments
HI Mihaela
Thanks a lot for this very interesting UNO dialog control
As you stated, somme comlex controls are missing (but you're the proof that work is ongoing :) ) . can the grid control be derived into un multicolumn list (by removing grid, headers) or would it be better to implement this feature in an other control ?
Thanks again
Laurent
Posted by Laurent Godard on September 25, 2009 at 11:08 AM CEST #
Hi Laurent,
thank you for your quick feedback.
The headers are defined as properties, so you can set these property values false.
I suppose that by removing the grid you mean not seeing the horizontal(or vertical) lines. Such property is planned but not yet implemented.
Please have a look at the Wiki page, there are some code snippets, which show how to implement the control in a java code.
Regards,
Mihaela
Posted by Mihaela on September 25, 2009 at 11:27 AM CEST #
Mihaela,
This new dialogcontrol will be very helpfull for a new OO-Dbase project we are working on.
In some cases we prefered using dialogs instead of "forms" because we have more control over how and under wath conditions the data will been pased to the database tables and we are missing a gridcontrol to show table-data.
My most important question is: Can the new control handels (showing)data comming from a Dbase, so yes, where can I find some starting sample code to make it happens in BASIC :-)
Thanks
Fernand
Posted by Fernand on September 28, 2009 at 07:19 PM CEST #
Mihaela,
Me again: some time ago I stumbled on a document showing some new Dialog controls, the grid control was one of them, but also a "spinning wheel" who indicates when the code is running and the user has to wait for a result. I do not find this doc and can not remember the author.
Was this doc comming from you or your team ?
Can you tell if this "waiting" control is also planned for a future relaese ?
Thanks
Fernand
Posted by Fernand on September 29, 2009 at 11:16 AM CEST #
Hi Fernand,
I'll post some simple BASIC example on the Grid Control Wiki page, so you can try it out.
At the moment the data, which is shown in the table must be a string. So if you want that your database data is shown in the table, you have to write subroutine which reads the data from database row wise and puts it in string array, which is then passed to DefaultGridDataModel.
The "spinning wheel" is UnoControlThrobber. To learn more about this control please take a look at api.openoffice.org.
Best regards,
Mihaela
Posted by Mihaela on September 29, 2009 at 12:00 PM CEST #
Hi Mihaela,
please add a note to http://qa.openoffice.org/issues/show_bug.cgi?id=74223
Posted by Peter on September 29, 2009 at 03:36 PM CEST #
Hi Mihaela,
Me again :-)
Thanks for the basic code on the Wiki pages.
As i can see: to have the content of a dbaseTable in a grid we have to do it manualy ?
First question, is at a option for yoy to implement the same functionality as we have in FORM table-grid-controls ( just make a conncetion to a Dbase Table.
like:
oConn = oDB.GetByName(MyOOdbase).GetConnection("User","Pasword")
oTable = oConn.Tables("MyTable")
With the options to move and delelete collums etc......
I supose most of this code is already present no ?
Greetz
Fernand
Posted by Fernand on October 01, 2009 at 04:19 PM CEST #
Hi Fernand,
I'm sorry to disappoint you, but I can't really help you with your request. My task is implementing the grid control feature and there is still a lot of work. As you can see on the wiki page there are 4 more milestones waiting to be done.
What content and how this content is put in the grid is IMHO the task of the developer, who is using the grid.
Best regards,
Mihaela
Posted by Mihaela on October 01, 2009 at 05:01 PM CEST #
OK,
But tell me, wath is the sence off a gridcontrol without a proper data-loader, for common users its nealry useless....
and for developers 99,99% of there data is comming from a table or a spreadsheet !
Please tell where to file a issue to convince your taskmanager to enlarge this task :-)
Greetz
Fernand
Posted by Fernand on October 01, 2009 at 08:18 PM CEST #
Fernand,
I wouldn't say that the current stage of the grid control is useless. You can open a database connection by your own and fill the column and data model of the grid control.
Our goal is to provide an infrastructure for developers. A developer might use the simple default column and data model or write his own models to provide data through the grid control. In your case a database provider.
You are right such a provider is really useful. But currently we don't plan to provide a database provider by default.
Regards
Tobias
Posted by Tobias on October 02, 2009 at 10:45 AM CEST #
Tobias,
Sorry but i was not awara about :
"Our goal is to provide an infrastructure for developers"
But what do you mean with Developers ?
- Profs who do most of there job in C++ or wathever :-)
- OO-Users who trye to automate there office suite (like me) and know their way in Basic or Java and who are the daily users of Dialogs
Do your statement also means that the Grid never will been available from the GUI
Greetz
Fernand
ps: PLease tell me are the Source codes for FORM Controls and DIALOG controls totaly incompatible ?
Posted by Fernand on October 03, 2009 at 12:33 PM CEST #
First, it is great to hear that something like the Grid is coming to Dialogs. But...
I was wondering, if it would not have been better to extend the Table Control that can be hosted in documents to also be embedded in Dialogs, that Table Control has a lot of the functionality that will have to be reimplemented.
Is it completely needed to have two different set of controls for Dialogs and for Forms? Is any source code shared between those implementations?
Posted by Martin on October 03, 2009 at 11:59 PM CEST #
Martin,
having a textTable control can already been done
Ariel Constenla-Haile mad this code (just replace the text entry by a table :-)
Sub FrameControl
On Error GoTo ERR_HANDLER_FRAME_CTRL
Dim oDlg as Object, oGhost as Object
Dim aPosSize
Dim oFrameControl
Dim oFrame as Object, oController as Object, oModel as Object
DialogLibraries.loadLibrary("Standard")
oDlg = createUnoDialog(DialogLibraries.Standard.FrameControl)
oGhost = oDlg.getControl("WIN_BEAMER") ' is empty FrameControl
'oGhost.setEnable(false)
aPosSize = oDlg.getControl("WIN_BEAMER").getPosSize()
oFrameControl = createUnoService("com.sun.star.frame.FrameControl")
oDlg.addControl("FRAME_CTRL", oFrameControl)
oFrameControl.setPosSize(aPosSize.X, aPosSize.Y, aPosSize.Width, aPosSize.Height, _
com.sun.star.awt.PosSize.POSSIZE)
Dim aLoaderArguments(1) as New com.sun.star.beans.PropertyValue
aLoaderArguments(0).Name = "Preview"
aLoaderArguments(0).Value = TRUE
aLoaderArguments(1).Name = "ReadOnly"
aLoaderArguments(1).Value = TRUE
'This property is not documented in the IDL
'http://api.openoffice.org/docs/common/ref/com/sun/star/frame/FrameControl.html
oFrameControl.LoaderArguments = aLoaderArguments
oFrameControl.ComponentUrl = "private:factory/swriter"
oFrame = oFrameControl.Frame
If NOT IsNull(oFrame) Then
oController = oFrame.Controller
If NOT IsNull(oController) Then
oModel = oController.Model
If NOT IsNull(oModel) Then
Dim oText as Object, oCursor as Object
oText = oModel.getText()
oCursor = oText.createTextCursor()
oCursor.goToStart(false)
oCursor.CharHeight = 60
oCursor.ParaAdjust = com.sun.star.style.ParagraphAdjust.CENTER
oText.insertString(oCursor, "Hello", false)
oCursor.CharHeight = 30
oText.insertControlCharacter(oCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false)
oText.insertString(oCursor, "com.sun.star.frame.FrameControl", false)
End If
End If
End If
oDlg.execute()
CLEAN_UP_FRAME_CONTROL:
'what do we have to dispose/close with the FrameControl?
If NOT IsNull(oDlg) Then oDlg.dispose()
Exit Sub
ERR_HANDLER_FRAME_CTRL:
MsgBox "Error " & Err & ": " & Error$ + chr(13) + "At line : " + Erl + chr(13) + Now , 16 ,"an error occurred"
Resume CLEAN_UP_FRAME_CONTROL
End Sub
Posted by Fernand on October 05, 2009 at 12:34 PM CEST #
Fernand,
developers like you are the target group of the grid control.
Our plan is to make the grid control available over the Basic IDE (see Iteration 5 on http://wiki.services.openoffice.org/wiki/API/UNO_AWT/Grid_Control).
We decided to implement a new grid control and don't reuse the implementation of the form grid control because of the complexity of the form grid control. It would result is a maintenance nightmare to make it usable in dialogs.
We are aware of the situation to have two different implementation of a grid control. In the future we want to enhance the new grid control implementation in this way that we can replace the form grid control implementation. But this needs a lot of time.
Regards
Tobias
Posted by 192.18.1.36 on October 06, 2009 at 11:04 AM CEST #