OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How te get Text Box value into a variable in a macro

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Draw
View previous topic :: View next topic  
Author Message
MarcG
Newbie
Newbie


Joined: 11 Apr 2008
Posts: 3
Location: Sint-Niklaas, Belgium

PostPosted: Fri Apr 11, 2008 10:55 am    Post subject: How te get Text Box value into a variable in a macro Reply with quote

Hi,

I am writing a macro which makes a drawing depending on the input a user gives in a text box.
My problem is that I want to get the user input into a variable so that I can work with this information in the macro. And I haven't found what I am looking for on internet and even not in this forum (or did I overlook ?).

Can anybody help ?

Thanks,
Marc
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 8983
Location: Lexinton, Kentucky, USA

PostPosted: Fri Apr 11, 2008 12:54 pm    Post subject: Reply with quote

Assuming the Text Box is the only thing in a Draw document this should get the text in it.
Code:
Sub Main
oDoc = ThisComponent
oDPages = oDoc.getDrawPages
oDP = oDPages.getByIndex(0)
oTB = oDP.getByIndex(0)
sText = oTB.Control.String
MsgBox sText
End Sub
Back to top
View user's profile Send private message
MarcG
Newbie
Newbie


Joined: 11 Apr 2008
Posts: 3
Location: Sint-Niklaas, Belgium

PostPosted: Fri Apr 11, 2008 10:16 pm    Post subject: Reply with quote

Thanks John,
that is the kind of information I needed.
I have got 1 more elements on the page, that is a button to start drawing, but in the code, it is just a matter of using the right index, so that won't be a problem.

I don't have time now, I'll try the code later and let you know more.

Thanks,
Marc Smile
Back to top
View user's profile Send private message
MarcG
Newbie
Newbie


Joined: 11 Apr 2008
Posts: 3
Location: Sint-Niklaas, Belgium

PostPosted: Sun Apr 13, 2008 12:15 am    Post subject: Reply with quote

Hi John,
I tested your example code and it works fine.
Now I can continue working on the macro.
Thanks ! Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Draw All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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