cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tyacko
Level 3

Setting text from a command button action?

Hi All,

I have two controls on a custom dialog. A button and a text control.

What I would like to do is click the button which brings up an external dialog (to get the user that will be assigned to my service component). The user would be chosen then when they exit the external dialog, they would be able to see the user chosen in the text box.

So far I have a "DoAction" that runs a VBScript custom action that gets the username and writes it to a property I called "SERVICE_USER_NAME", but I can't figure out how to have the text box "subscribe" to the setting of the property so that the username is shown.

Is this possible? If so, could you describe how this should be done? I don't understand the "subscribe" stuff.

Thanks for any help.
Tom
Labels (1)
0 Kudos
(6) Replies
tyacko
Level 3

I'd really apprecriate some help here.

Thanks.
0 Kudos
jedimaster_mark
Level 7

Oh, ok... I wasn't going to reply to this one, because I thought I might be missing something, but since you seem to be in need...

Ok, the thing I am missing is that I do not know what this "subscribe" thing you refer to is. But, I have encountered this issue in the past, and what I came up with is that there are two ways to handle this. The problem here is that the text control you have (which I assume is set to display a property) is loading the property at the time that you load the dialog, at which point the property isn't populated yet. As I said, I know of only two ways to accomplish what you're trying to do, and one of them has slipped my mind at the moment, so I'll go with the one I remember:

Create two dialogs, identical in every way, with one exception. Your button control (which will also be identical), will - as its last action - load the other dialog. And vice versa for the other button. In essence you're making a loop where the button alway loads the clone of the dialog it was called from. This way, you populate the text with some action on the button, and then when you hit "OK" or whatever you do, it loads the other dialog, except that now the property has a value, so the text displays.

Does that make sense?
0 Kudos
tyacko
Level 3

jedimaster_mark,

Thanks for the response.

The "subscribe" thing I was talking about is the "Subscriptions" tab found on the "Edit behavior" screen of a dialog. I "thought" that by subscribing to an event of another control, you could cause other UI elements to be updated.

As you've suggested, it looks like doing the "SpawnDialog" might be my best option. I've seen that once I click the "Next" button on my dialog, then click the "Back" button on the following screen that the text control will now display the text I was expecting. Apparently there isn't a straight-forward way to push text to a text control based on an event from another UI component. This is unfortunate.

I'll try using your suggestion. Again, thanks for the help.

Tom
0 Kudos
jedimaster_mark
Level 7

Hmm... I suppose I should look into that tab. I was advised (and rightly so) to learn the core principals of Windows Installer and MSI architecture first, which I did. So, when I come across roadblocks like this, I go back to the fundamentals to devise a solution. This frees me from the limitations of the tool.
0 Kudos
tyacko
Level 3

jedimaster_mark,

I've successfully implemented your suggestion. So, thank you for your help with this issue.

One thing I want to note here in case anyone else needs to do something like this and reads this thread. Make sure that you set your condition in the ControlEvent table to at least the value of 1 (meaning don't leave this field in the table blank) even if you don't have a condition per-say that you need to check on before executing this dialog switching technique.

I spent about an hour trying to figure out why my cloned dialog wasn't being executed after the button control. Once I put a condition of 1 in the ControlEvent table for the dialog action then it worked as expected.

Thanks again,
Tom
0 Kudos
jedimaster_mark
Level 7

You are very welcome. I need to turn to the forums for help from time to time, so it's only right that I give back to them.
0 Kudos