Web Contrainer as toolbar

Hi Guys,

I create a Web Contrainer composed of multiple WebImageView and named it as MINITOOLBAR.

I dragged it to WebPage to form mimic as toolbar.

Please teach me how to trigger click event on each picture within the Wegpage code behind.

Use the MouseUp event.

http://documentation.xojo.com/index.php/WebControl.MouseUp

Thanks for the reply.

But how to know which WebImageView was clicked within the Web Contrainer?

Anybody know how to do it?

[quote=211080:@ronaldo florendo]Thanks for the reply.

But how to know which WebImageView was clicked within the Web Contrainer?

Anybody know how to do it?[/quote]

Each WebImageView has its own event, right ? Just like buttons Action event…

Hi Michel.

Im so happy that you keep active here.
Regarding your reply.

“WebImageView has its own event,” - Thats correct. But those click events are not accessible if the Webcontainer was placed in a Webpage.

Do you know work around for this?

[quote=211084:@ronaldo florendo]“WebImageView has its own event,” - Thats correct. But those click events are not accessible if the Webcontainer was placed in a Webpage.

Do you know work around for this?[/quote]

What do you mean ? You add the event to the WebImageView in the WebContainer just as simply as you would do it in a WebPage !

Hi Michel

Here is what I did.

#1. I add Webcontainer to my project and named it as MiniToolbar.
#2. I place 6 WebImageView aligned horizontally and put icons on it.
#4. I paste MiniToolbar to the webpage.

Now, In the WebPage, I want to determine which WebImageView (from MiniToolbar) was clicked.

How can I do it?

Ronaldo, instead of asking questions :

  • Add the MouseUp event to one of the ImageView
  • In that event, put
Msgbox "clicked WebImageView1" // whatever number you need
  • Run the program and click on the damn WebImageView

That is how.

You add an event on each WebImageView. JUST LIKE YOU WOULD WITH BUTTONS !

Afaik you can’t.
You have to handle the clicking on a WebImageView within the WebContainer.
Your WebImageViews are part of the WebContainer and not of the WebPage

[quote=211119:@Paul Sondervan]Afaik you can’t.
You have to handle the clicking on a WebImageView within the WebContainer.
Your WebImageViews are part of the WebContainer and not of the WebPage[/quote]

Oh, I did not quite get his question. Sorry.

The solution is to set a property on the WebContainer, for instance ImageClicked, which he sets in the MouseUp event of each WebIMageViewer, and that will be available as a property of the instance.

Add an event definition to your container which has an identifier for the webimageview clicked. In the mouse up event trigger that event with the unique identifier. On the web page implement that event using the identifier to determine which iamge was clicked.

If I were implementing this I would make the webimages a control set. This will give them each an Index and a single event handler for the mouseup event. You can then bubble this event to the parent by calling the defined event with the index of the control.

You might also want to review this video.

I followed all your suggestion, but suggestion of Wayne Golding has a better solution.

I would like to share to you my codes for creating custom toolbox so that everybody can improved it for the sake of beginners like me.

Thanks for the help guys. Im sharing my leanings now. Please download below.

https://mega.nz/#!RwMR1ChT!7Jfo_dzIW9P_uo3xFWqe4FLfdQ4qPEO3jCj8vefs_uo