#1 2015-11-11 02:00:54

johnclarke
Member
Registered: 2015-11-11
Posts: 5

Using the Menu Component and other related questions

When I use the menu component is there any way that I can specify which menu item I want to be selected using code ?

Thanks in advance.

John

Offline

#2 2015-11-11 02:08:02

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Using the Menu Component and other related questions

Hello John,

What you need is to know how to react for specific item clicked by the user? If so, take a look at the Menu* app samples. The Menu stores their items as an Array, and they offer an "ItemClick" even wich inform us about the item index choosed by the user.

Offline

#3 2016-12-03 09:07:40

Tonym
Member
Registered: 2016-12-03
Posts: 26

Re: Using the Menu Component and other related questions

Hi David I saw your program and its fantastic.

How do I change veiws based on item selected from a menu

Offline

#4 2016-12-03 09:54:02

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Using the Menu Component and other related questions

Hello Tonym,

Thanks for your kindly words! A posible problem to achieve what you wanted is that the menu items (or Dropdown items, or Select items, etc.) maybe have not the same name than the app's views, so we can't simply use the menu items text as the app's views' names. In other words, if the menu's items' text match the app's views' names, then the below code in the menu's "ItemClick" event can do the job:

// Get the selected item's text
ArrayGetItem "[Menu1.Items]" "[Menu1.ItemIndex]" "[ItemText]"

// Use the item's text as the view's name
ReplaceView "[ItemText]"

If that's is not the case, we must to find a way to associate our menu's items with the app's views and then use the menu's items' index instead of the items' text. To achieve this probably we can take several paths. For example, a possible way is to use an Array variable to associated the menu's items' index with the app's views:

NewArray "[ItemsViewsMap]"
ArrayPush "[ItemsViewsMap]" "View2"
ArrayPush "[ItemsViewsMap]" "View3"

The above code can be placed in the App's Ready event, for example, then the Array variable become available when the application starts. With such variable we can place the below code in the menu's "ItemClick" event:

// Get the view's name based in the selected item's index
ArrayGetItem "[ItemsViewsMap]" "[Menu1.ItemIndex]" "[ViewName]"

// Goto the appropiate app's view
ReplaceView "[ViewName]"

I implement the above two possible ways in a couple of samples that can be downloaded: MenuViews.zip. Hope they can help you and maybe others with a similar question.

Offline

#5 2016-12-03 11:24:47

Tonym
Member
Registered: 2016-12-03
Posts: 26

Re: Using the Menu Component and other related questions

Wow David
Thanks so much for the prompt response i am really impress.

I will let u know of the outcome.

Offline

#6 2016-12-03 11:26:05

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Using the Menu Component and other related questions

Hello Tonym,

Tonym wrote:

Wow David
Thanks so much for the prompt response i am really impress.

I will let u know of the outcome.

You're welcome! Just let me know if you have any further question.

Offline

#7 2016-12-05 12:05:38

Tonym
Member
Registered: 2016-12-03
Posts: 26

Re: Using the Menu Component and other related questions

Hi David,

I tried it and it worked fanastic
Thanks a lot

Offline

#8 2016-12-05 12:07:11

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Using the Menu Component and other related questions

Hello Tonym,

Tonym wrote:

Hi David,

I tried it and it worked fanastic
Thanks a lot

Glad to know! Please, consider to buy one or more App Builder licenses if the program is useful for you!

Offline

#9 2016-12-05 12:08:51

Tonym
Member
Registered: 2016-12-03
Posts: 26

Re: Using the Menu Component and other related questions

Another question i have:
Is there a way to embed a webpage in app builder

Offline

#10 2016-12-05 12:11:44

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Using the Menu Component and other related questions

Hello Tonym,

Tonym wrote:

Another question i have:
Is there a way to embed a webpage in app builder

Yes; You can use the IFrame control. Take a look at the IFrames application sample.

P.S. Please, open a new thread when you have new questions, then we can maintain the forum well organized.

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.