How to display a menu based on another menu's submenu items (Joomla 2.5) - joomla2.5

This is probably really easy to do and I'm probably missing the wood for the trees but I'm trying to display a menu on a selection of pages which contains the sub menu items from the equivalent main menu item.
For example, the main menu has 'Products' (parent item) listed with 'Product 1', 'Product 2' and 'Product 3' as sub menu items (child items). Is it possible (without creating duplicate articles) to create a submenu which only shows the child items but which links to the same articles as from the main menu?
I've read about using menu-alias but none of the documentation I've found gives a clear message on this.
Thanks.

1) Go to Menus -> Menu Manager -> Add Menu.
2) Add a new menu item in it, choose for type Menu Item Alias and on the right side under Menu Item choose which Menu you want it to be the copy of (not a real copy, but an alias).
3) Repeat 2) for all menu items you want to display
4) In Module Manager, add new Menu module, choose your newly created Menu, assign it to some position and publish.

#Marko D's solution works well and can be customised to suit many variations.
There's another option in this case where you don't event need to create another menu or menu aliases.
1) In module manager, add a new menu module, name it, position it, apply it to the relevant pages, then under Basic Options choose the main menu in question and a start level of 2 and publish
2) No number 2 ;)
It's always good to have more than 1 option!

Related

Winforms controlling controls

I couldn't think of a coherent search term for my problem so please forgive me if this has been asked before.
I have 24 combo boxes sitting on a panel control, displayed in 4 rows of 6.
After the user defines the value for each combo and hits the "go" button, I add all combo boxes to list so I can use the values in another section of my program.
The problem is that the order the comboboxes are added to the list is messed up, compared to their visual layout on the panel, and I would like to define the order. Currently, it adds the 9th combobox to the list first then the 20th, 2nd, 16th etc etc.
I tried TabIndex but that didnt work.
Before I manually rename and relabel all of the boxes, any other suggestions will be gratefully received.
The controls of your form exist in Controls collection of the container controls, for example when you add a Panel and a Button to a Form and two ComboBox to the Panel, then:
Form.Controls contains button1 and panel1
Panel.Controls contains comboBox1 and comboBox2
Controls are added to the Controls collection, with the same order that you add them to designer. Open designer.cs, look at the end of InitializeComponent to see the order.
You can also see/change the order using Document Outline window.
That said, now it should be obvious that panel1.Controls.OfType<ComboBox>() returns combo boxes with the same order that you see in Document Outline (or based on their z-index, and it doesn't have anything to do with their x/y placements).
You may want to order them based on TabIndex, or any other property that you like:
panel1.Controls.OfType<ComboBox>().OrderBy(x=>x.TabIndex)
Note
In general, if you are going to use those values for a search, instead of relying on the order of values, a much better idea is creating a SearchModel class which has a few properties, the set those properties to the selected value of the corresponding combo box (manually or using databinding) then pass the search model to the other classes.

Apex button to insert new rows

I'm using Application Express to build a page with a form that shows all the rows in Table A. Table A has to contain all the values from Table B that have a specific "Status".
I'm looking for a way to update Table A so that new rows with the correct status from Table B are added to Table A.
Is there a way to add a button to the page that inserts into Table A those rows? I have no problems with coding the query itself, but on Apex' Page Designer, when I add a button (which I called Refresh) to the page, I can't find a place to add the Insert Query.
Any tips?
there are several ways to do what you need, the simplest one would be to bind a dynamic action to the click event on the button.
On the button definition go to "Action when button clicked" region and on the action field select "Defined by dynamic action"
On execute validations choose "No"
Then, back on the page definition, create a dynamic action, on Event choose "Click", on Selection type choose "Button" this will make a field named button appear whit a list of the available buttons to choose.
In condition you can define a true/false evaluation. if so then you would be able to define actions to execute in both cases, if you leave it empty ("No condition") then all the actions defined will be executed.
Once defined click next and here you decide the action type, the one you need is "Execute PL/SQL Code", which will show a text field on which you can paste your code, and the parameters needed from the page.
finally you can specify if the action will have a repercussion on any kind of visual component on the page, this is for efficiency, but is not necessary.
That would be all, once created, when you click the button the code will be executed on the server.

Start drag action from a menu item

Given a QTreeView I would like to provide the user a means of inserting new items. For this I created a QMenuBar that contains several categorizing sub menus that in turn contain the different kinds of items the user can insert.
My first implementation was to select some existing item in the tree and then pick a menu item which is then inserted as a child of the selected item in the tree. There were buttons for rearranging the items, such as 'move up', 'move down' and so on. Later I replaced these buttons by a drag&drop interface where the user can simply drag items in the QTreeView around to rearrange them, which seems quite intuitive to me.
Now inserting new items into the tree by clicking menu items still feels annoying. In my opinion a more natural approach would be to drag the items out of the menu and into the desired location of the tree.
So is there a sensible way to implement this behaviour? My problem is how to start a drag operation by clicking a menu item as the triggered() signal is just emitted when the user releases the mouse button. But with the mouse button released, there is no drag anymore...

Tkinter - Changing the list in Option Menu

Is there a way to manipulate the List displayed by the OptionMenu in respect to what the user has currently selected?
For example, let's say I have a list - ["A","B","C"].
If the user currently selected A then if he clicks the optionmenu with A currently selected, what he will see in the list is not the original list but only B and C.
If he switches his answer from, let's say, A to B, then now, he will only see A and C in the OptionMenu.
And the same will follow if he chose B or C.
Thanks!
The OptionMenu widget is a button that shows a dropdown menu when pressed. You might do better to use a ttk.Combobox instead as that is a more modern UI element and you can very simply configure the values configuration item.
You can configure the attached menu at runtime. You access the menu using optionmenu['menu'] and you can then query items on the menu optionmenu['menu'].entrycget(0, 'label') or use entryconfigure to modify the items. Or you can delete items optionmenu['menu'].delete(index) and add new items. See the menu documentation for hints on manipulating the menu entries.

Dealing with huge select lists

I often use select lists with my projects but when it comes to a huge select list, I couldn't find a solution. I need a easy, plug and play solution for solution will be used in a few places.
When you have a select box or text box to be filled from a model data, I want to show user a text box, right side of text box, there should be a button to choice the value. Upon clicking that button, popup or a modal will be opened and I filter all the records and find my value, upon clicking value, modal or popup closes and I get choosen value to form control.
İmagine you have a text box to choose your customer, and among 2500 customer,
PS:don't suggest autocomplete, don't want to accomplish it.
Why don't you look at something like Chozen plugin http://harvesthq.github.io/chosen/. It allows you to easily search large select lists