extract textfield text from dialogue

A simple process that has me stumped. I have no issues with getting listbox values but I now have a dialogue1 with a textfield10, with its event set on mouse press. I cannot get the text out of the field. I am stuck with ‘object variable not set’.

Public d
d = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
MsgBox(d.getByName("TextField10").Text)

I have floundered around with all sorts of words!

I also wish to grab 3 entered text field strings and write them to a sheet using a command button. It is getting the syntax for extracting the strings that is causing the problem and I can find no documentation.

Hello,

you need to get the dialog model:

MsgBox(d.Model.getByName("TextField10").Text)

Edit:

Sorry, incorrectly interpreted the need. Just put in a variable:

Dim myText as String
myText = d.Model.getByName("TextField10").Text

myText then contains the text and you can move this where you want.

For links on Base and macros, see this post → To learn LibreOffice Base are there introductions or tutorials?

This:
MsgBox(d.getControl(“TextField1”).Text)

  • like your syntax, also will produce the text in a ‘pre-filled’ (label-like) text field but will not read a text field I fill in ‘live’ before activating the ‘event’, and I wish to retrieve several such filled-in text fields and store in variables to process.

Where do I look to read about all these ‘getModel/get Control/getByName’ etc etc procedures?

@mikejp,

please see edited answer.

If this answers your question please tick the :heavy_check_mark: (upper left area of answer). It helps others to know there was an accepted answer.

OO/LO are a fantastic development, but the ‘education’ side has always been poor. This is where the ‘darkness’ that surrounds OO/LO starts. I have looked through a lot of those links but can find no guide to the various queries I listed - ‘getModel/get Control/getByName’ etc

Not wishing to be ‘picky’ here , but you say “you need to get the dialog model:” - but when I visit debugpoint.com they say ‘no you don’t - you can use ’ d.getControl(“TextField11”).getText’ - which works fine - no '‘model’ required! Poor me is left wondering why there are so many ways to skin the cat - which is ‘right’/‘netter’, why do both work - and how do I find out.

I now have the coding sorted, thanks, but would dearly love to understand more.

The documents pointed to (specifically macro documents) contain the information you want. Also MRI & XRay allow direct examination of Settings, methods and more. Most people dealing with macros have spent many months just getting started and familiar with the basic concepts of UNO. You have spent only a couple of hours, received a link to much of what many of us spent a lot of time accumulating, and it appears that is still not enough. There are no classes on this. It is individual learning and cannot be done with Q&A on sites like this.

Since you have not been respectful of my requests (asked many times about not using proper user name) and you seem to be cross posting without notifying (can and will occur duplicate effort), I will no longer continue here. There will be others who may answer.

Will add, in one of the documents, OpenOffice Macros Explained, it has references and tables and examples of the items you asked about. For example getModel() notations starts on page 611. There is much throughout that document. It also discusses the Model and View. The other items you asked about are there also. The OpenOffice Developers Guide also contains this information.

And yet there is no cost for any of it. Not for LO, OO or any documentation. You need to look for the information. In this case it was given to you in a post but there is a lot of it and you need to research.

“you seem to be cross posting without notifying (can and will occur duplicate effort),”

Well, that’s Greek to me - are you? Perhaps someone else could explain what that means? As a forum mod elsewhere I at least understand the term. I suppose it is language issue?

Regrettably the ‘ask LibreOffice’ forum fails in its intent.

PS Read all the stuff.

I wish the project well - it deserves to succeed but not like this.