Reading the label from a button in a dialogue - how?

View: New views
5 Messages — Rating Filter:   Alert me  

Reading the label from a button in a dialogue - how?

by Johnny Rosenberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Option Explicit

Sub Test
        Dim Ctl As Object
        Dlg=CreateUnoDialog(DialogLibraries.Standard.MyDialog)
        Ctl=Dlg.getControl("CommandButton1")
        Xray Ctl
End Sub

As far as I can see, using Xray, there is a setLabel method, but there
is no getLabel method. The Label variable seems to be write only. This
is really terrible (for me), if there is no workaround, because I
really need to read the label (hopefully without creating a global
variable that also contains the label…).

Of course most people want to know what I am trying to do…
Well, I have a command button and I want it to display different text
depending on the situation. That's easy since I can easily set the
label with the setLabel method. However, when a certain text is
displayed on the button, some things need to be done differently when
clicking the button, so I need to know the ”state” of the button. Is
it a ”Do this” button or is it currently a ”Do the other thing”
button? I really need to know that, or at least my subroutine does.
Of course I could have two different buttons, but I thought this would
be cool, and that's reason enough for me to try to achieve this…

Best regards

Johnny Rosenberg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Reading the label from a button in a dialogue - how?

by Cor Nouws :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Johnny,

Johnny Rosenberg wrote (6-9-2009 20:43)

> Ctl=Dlg.getControl("CommandButton1")
       
      Dlg.getControl("CommandButton1").getModel.text = ""

will work


Cor

--
Cor Nouws
   - nl.OpenOffice.org marketing contact
   - Community Contributor Representative in the Community Council
Gevoel niet vrij te zijn? Zie www.nieuwsteversie.nl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Reading the label from a button in a dialogue - how?

by Johnny Rosenberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/9/6 Cor Nouws <oolst@...>:

> Hi Johnny,
>
> Johnny Rosenberg wrote (6-9-2009 20:43)
>
>>        Ctl=Dlg.getControl("CommandButton1")
>
>
>     Dlg.getControl("CommandButton1").getModel.text = ""
>
> will work

No, it won't. There is no getModel().Text

The ones starting with a T are:
”Tag”
”TextColor”
”TextLineColor”
”Toggle”
”Types”

”Text” just isn't there. And I can't find a method for getting it either.


Best regards

Johnny Rosenberg

>
>
> Cor
>
> --
> Cor Nouws
>  - nl.OpenOffice.org marketing contact
>  - Community Contributor Representative in the Community Council
> Gevoel niet vrij te zijn? Zie www.nieuwsteversie.nl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Reading the label from a button in a dialogue - how?

by Cor Nouws :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Johnny Rosenberg wrote (6-9-2009 22:15)
> 2009/9/6 Cor Nouws <oolst@...>:
>>     Dlg.getControl("CommandButton1").getModel.text = ""

> No, it won't. There is no getModel().Text

Ahrrgg, sorry, my mistake
I use
        Dlg.getControl("CommandButton1").getModel.Label

--
Cor Nouws
   - nl.OpenOffice.org marketing contact
   - Community Contributor Representative in the Community Council
Gevoel niet vrij te zijn? Zie www.nieuwsteversie.nl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Reading the label from a button in a dialogue - how?

by Johnny Rosenberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks! That works!

Option Explicit

Sub Test(Count As Integer)
        Dim Ctl As Object
        Dlg=CreateUnoDialog(DialogLibraries.Standard.MyDialog)
        Ctl=Dlg.getControl("CommandButton1")
        Ctl.setLabel("Testing!")
        Print Ctl.getModel.Label ' Prints ”Testing!"
End Sub


Best regards

Johnny Rosenberg


2009/9/6 Cor Nouws <oolst@...>:

> Johnny Rosenberg wrote (6-9-2009 22:15)
>>
>> 2009/9/6 Cor Nouws <oolst@...>:
>>>
>>>    Dlg.getControl("CommandButton1").getModel.text = ""
>
>> No, it won't. There is no getModel().Text
>
> Ahrrgg, sorry, my mistake
> I use
>       Dlg.getControl("CommandButton1").getModel.Label
>
> --
> Cor Nouws
>  - nl.OpenOffice.org marketing contact
>  - Community Contributor Representative in the Community Council
> Gevoel niet vrij te zijn? Zie www.nieuwsteversie.nl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...