Accessing properties of control within Webcontainer

How can I access properties of a control imbedded within Webcontainer?

I have Webcontainer with 2 buttons. This container is attached to my toolbar.

The toolbar is used on a Webform.

I want to set VISIBLE property to the 2 button.

How?

Keep a reference to the WebContainer outside of the toolbar, stored in a property.

Any sample code I can follow?

There are several examples in the docs:

http://documentation.xojo.com/index.php/WebToolbarContainer

Thanks for the reply but its for “Accessing Web Page Information from the Container”,

What I need is to access Container from the Web Page (the inverted way).

Any other resource to dig in?

i tried this code in the OPEN event of Web Form.

Toolbar1(ToolboxLogoutControl(me.ItemWithName(“ButtonLogout”)).Container).Visible = true

where:
Toolbar1 = is the name of the toolbar pasted within the Web Form
ToolboxLogoutControl = is the Web Container imbedded in the Toolbar1
ButtonLogout = is the button name resided at the ToolboxLogoutControl web container.

I got syntax error.

Kindly please help for the poor.

[quote=209051:@ronaldo florendo]i tried this code in the OPEN event of Web Form.

Toolbar1(ToolboxLogoutControl(me.ItemWithName(“ButtonLogout”)).Container).Visible = true

where:
Toolbar1 = is the name of the toolbar pasted within the Web Form
ToolboxLogoutControl = is the Web Container imbedded in the Toolbar1
ButtonLogout = is the button name resided at the ToolboxLogoutControl web container.

I got syntax error.

Kindly please help for the poor.[/quote]

Please post the code you use to embed the control, as well as, if relevant, the code you use to embed the container. That will help showing you what to do.

It is just a matter of namespaces, but dynamic embedding require a bit of extra work.

Thanks Michel.

There is not special code on my program to imbed the control. everything is created via drag n drop and copy paste.

Then, i use this code “Toolbar1(ToolboxLogoutControl(me.ItemWithName(“ButtonLogout”)).Container).Visible = true”
to reference the object.

All I need is to make ButtonLogout visible once succesful login.

I hope you can help me.

[quote=209073:@ronaldo florendo]Thanks Michel.

There is not special code on my program to imbed the control. everything is created via drag n drop and copy paste.

Then, i use this code “Toolbar1(ToolboxLogoutControl(me.ItemWithName(“ButtonLogout”)).Container).Visible = true”
to reference the object.

All I need is to make ButtonLogout visible once succesful login.

I hope you can help me.[/quote]

OK. WebToolBarButtons have no Visible property. But you can make them invisible by removing the caption, the icon, and disable them.

This will hide and disable the second item on the toolbar :

WebToolbarButton(Toolbar1.ItemAtIndex(1)).caption = "" WebToolbarButton(Toolbar1.ItemAtIndex(1)).Icon = nil WebToolbarButton(Toolbar1.ItemAtIndex(1)).enabled = false

To reinstate the button, you will need to do the reverse :

WebToolbarButton(Toolbar1.ItemAtIndex(1)).caption = "do stuff" WebToolbarButton(Toolbar1.ItemAtIndex(1)).Icon = myIcon WebToolbarButton(Toolbar1.ItemAtIndex(1)).enabled = true

Again, thank you for your effort on trying to help me.

I attached the actual photo of my TOOLBAR so that you can have ideal.

This is my script: “Toolbar1(ToolboxLogoutControl(me.ItemWithName(“ButtonLogout”)).Container).Visible = true”

where:
Toolbar1 = is the name of the toolbar pasted within the Web Form
ToolboxLogoutControl = is the Web Container imbedded in the Toolbar1
ButtonLogout = is the button name resided at the ToolboxLogoutControl web container.

I hope, I clarify my question.

Your help is very much appreciated.

[quote=209089:@ronaldo florendo]Again, thank you for your effort on trying to help me.

I attached the actual photo of my TOOLBAR so that you can have ideal.

This is my script: “Toolbar1(ToolboxLogoutControl(me.ItemWithName(“ButtonLogout”)).Container).Visible = true”

where:
Toolbar1 = is the name of the toolbar pasted within the Web Form
ToolboxLogoutControl = is the Web Container imbedded in the Toolbar1
ButtonLogout = is the button name resided at the ToolboxLogoutControl web container.

I hope, I clarify my question.

Your help is very much appreciated.[/quote]

You actually probably need Greg’s help. I was not able to access the button inside the container either.

Greg, HELP !

You shouldn’t be trying to access a button within the container, the container should be a “black box” that the rest of the app communicates with via its properties and methods.

So, you can access that container, create a method on it such as “ToggleLogOut” or similar that you can use to tell the control that the user is logged in or out, in that method you show/hide/re-caption the buttons as needed.

You should also have events on the container that expose the actions from the logout button etc.

I hate it when I cannot do something I know must be possible. Here is how I access the button Visible property from a button on the page :

CC1(WebContainer(WebToolBarContainer(ToolBar1.ItemWithName("ToolboxLogoutControl")).Container)).ButtonLogout.Visible = _ not CC1(WebContainer(WebToolBarContainer(ToolBar1.ItemWithName("ToolboxLogoutControl")).Container)).ButtonLogout.Visible

Each time this line is run, it toggles between visible and hidden.
Here is the way it works:
0. I get the WebControl corresponding to the WebToolBarContainer with ToolBar1.ItemWithName("ToolboxLogoutControl")
0. Cast that to WebToolBarContainer
0. Cast the WebToolBarContainer to WebContainer
0. Cast the WebContainer to CC1 which is the target class of the WebContainer

All these successive casts la Matryoshka doll let you access the web container content and properties, the same way you would do it for an instance placed on a WebPage such as myWebContainerInstance.Button1.Caption = "Test".

Amazingly, the LR page http://documentation.xojo.com/index.php/WebToolbarContainer provides for ways to access the Webpage from inside the container, but is very unclear about accessing the content of the container.

Does this technique work already?

I tested before I posted. How do you think I found out that way of accessing the button ? Of course it works.

Don’t make me feel like all the work I put into it for you is in vain, please. At least, give it a try.

Hi Michel,

Im just asking.

Thank you very much for your effort. I really really appreciate it.

I hope your not angry. Peace.

I will try it now on my project.

[quote=209501:@ronaldo florendo]Hi Michel,

Im just asking.

Thank you very much for your effort. I really really appreciate it.

I hope your not angry. Peace.

I will try it now on my project.[/quote]

I am not angry, Ronaldo. Just telling you I verified it to work. The only thing I did not know is the name of your WebContainer. If you have not renamed it, that would be ContainerControl1. In my code, it is CC1.

Its now clear to me Michel.

Are you from XOJO technical support?

You responded so quickly compared when I send concern via email.

[quote=209506:@ronaldo florendo]Its now clear to me Michel.

Are you from XOJO technical support?

You responded so quickly compared when I send concern via email.[/quote]

I am just a user like you :slight_smile:

Oh ic.

Can I add you to my facebook account? mine is “rsflorendo” or “ronaldo florendo”

Thanks MIchel.