Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing |
Summary: | creating dialogs not working first time | ||||||
---|---|---|---|---|---|---|---|
Product: | General | Reporter: | grval <grval> | ||||
Component: | scripting | Assignee: | AOO issues mailing list <issues> | ||||
Status: | ACCEPTED --- | QA Contact: | |||||
Severity: | Trivial | ||||||
Priority: | P3 | CC: | flibby05, issues | ||||
Version: | OOo 1.1.2 | Keywords: | oooqa | ||||
Target Milestone: | AOO Later | ||||||
Hardware: | PC | ||||||
OS: | Linux, all | ||||||
Issue Type: | ENHANCEMENT | Latest Confirmation in: | --- | ||||
Developer Difficulty: | --- | ||||||
Attachments: |
|
Description
grval
2005-02-07 22:22:39 UTC
np->tbe Have you seen this behaviour before? TBE->GRVAL: I cannot reproduce this task on OOo 1.1.3. Can you please provide a bug doc with the whole macro in order to reproduce this task. In what way do you run the macro? From the Macro dialog or via an event binding? Nevertheless I assume that you don't load the corresponding dialog library. Please see the macro below, this should work. Sub Main() Dim oLibContainer As Object Dim oLib As Object Dim oInputStreamProvider As Object Dim oDialog As Object Const sLibName = "Standard" Const sDialogName = "Dialog1" REM get library and input stream provider oLibContainer = DialogLibraries oLibContainer.loadLibrary( sLibName ) oLib = oLibContainer.getByName( sLibName ) oInputStreamProvider = oLib.getByName( sDialogName ) REM create dialog control oDialog = CreateUnoDialog( oInputStreamProvider ) REM show the dialog oDialog.execute() End Sub Ok, that code works, but it creates a new problem. I can't access the controls on the dialog. I discovered that my code works if it isn't called from an event. However, if I call it from an event, I get a null dialog container. REM getCriteria REM REM get criteria for report from user REM prefill with values from current report if present REM Sub getCriteria() ' declare objects to reference our date controls from our dialog box Dim asOfDateControl as object dim oLib as object dim dlgDef as object oLib = DialogLibraries.getByName("Standard") dlgDef = oLib.getByName("CriteriaDialog") if IsNull(dlgDef) then msgbox "Dialog not defined." end if oDlg = CreateUnoDialog(dlgDef) asOfDateControl = oDlg.getControl("asOfDate") asOfDateControl.setDate(CDateToISO(now())) ' set From Date control oDlg.execute() ' show dialog box End Sub So I get "Dialog not defined." when calling from a button. The macro and the dialog are both in the documents standard library, so they should be loaded. TBE->GRVAL: You're right. Only the Standard MODULE library (application + document Basic) is loaded by default. The Standard DIALOG library is NOT loaded by default. Therefore you need the loadLibrary call in your macros in order to work. I will forward this task to AB for further evaluation. Probably it makes sense to load also the Standard dialog library by default. Created attachment 22575 [details]
i42240.sxw (contains two buttons with an event binding to Standard-Module1-Main)
TBE->AB: Please evaluate. Ah yes, loading the standard dialog library works. set to NEW, oooqa can do nothing about this Accepted as OOo 2.01 enhancement, not as defect as it's not specified that the Standard dialog library has to be preloaded. But it would make sense to preload the Standard dialog library because the Basic IDE does it and so forgetting to load the library in the Basic code is not easy to detect. Per agreement with MBA and AB i set this task to OOo Later. Reset assigne to the default "issues@openoffice.apache.org". |