Add/Remove controls dynamically in .NET 2.0 CF Forms project - user-controls

I am working on a mobile 2.0 project that is displaying a list of custom controls (each containing labels and check box). I want to find a better way to keep track of control positions.
The controls are contained within a scrollable panel.
The hierarchy of controls is basically like this
Menu Type 1
Menu Sub Type 1
Menu Item 1
Menu Item 2
Menu Type 2
Menu Sub Type 2
Menu Item 3
Menu Item 4
And the way I add them initially is panel.Controls.Add(controlToAdd)
And each subsequent control's position is determined by the previous control:
newControl.Top = lastControl.Bottom
That works fine on initial load, but I now need to be able to add/remove controls. I know I can just
find where I need to insert it
set the new controls location
change the positions of all controls that follow it (offset based on the height of the new control)
But that seems like a "bad" way since if the control always adds at the front, every single latter control needs updating. Is there a way to better manage the positions of all the controls to ease additions and removals dynamically?

Related

Keyboard accessibility ( WCAG) in panels with list of elements that has assigned button role

Hi :) I would like to ask you about how to treat elements that compose a list, but whom have assiged a button role and are put in side panel ( so it is not a menu or dropdown). My main problem is how to decide is to where ARROWS should works and where TAB.
Moreover I have a differ types of list items that consist of:
checkbox/ radiobutton only
checkbox/ radiobutton with a link to another panel
two icons/ buttons that has defined an activities etc.
Please look at pictures and help me please :)
PINK - "arrows"
BLUE - "TAB"key
You should hardly decide which component will use TAB key or Arrow Keys. Keyboard accessibility for a large number of components is already defined in WAI-ARIA Authoring Practices.
Adding a different behavior could create issues to both sighted, and non-sighted users because they'll already be knowing which key to use based on the component or they'll know intuitively because of standard roles or they'll know as they use keyboard more to browse.
Offer List
Listbox will work. Arrow Keys to navigate and Enter key to perform the action.
List of Checkboxes and Radio Buttons
I would recommend to keep Checkboxes and Radio Buttons to their default keyboard behavior. Since your cases are more of a list, you can convert the list of checkboxes and radio buttons to Single Select and Multi Select Listboxes and use Checkbox and Radio Button as a font icon or graphic to show the selection, similar to how tick is shown in this Listbox example. When you convert to a Listbox, you'll meet the Arrow Keys requirement.
Selected Fruits List
There are some issues in the required keyboard behavior: How will user know if Arrow-Left or Arrow-Right need to be presed, think about non-sighted users.
Fruit Name and i icon button
In your need, you want both Fruit Name and i icon button to open a panel, suggest to NOT use Arrow-Right to i icon button and only use the Enter key to open the panel. May be you don't need i icon button at all.
Delete icon button
Suggest to use DEL key to delete the item
Conclusion
Remove i icon button. If you can't just keep it as graphic element without any events
Use Enter key to open the panel
Use DEL key to delete the item
I think the whole list will then become a listbox, navigable using Arrow Keys and Enter to invoke an operation
Vegetables List
Neither Accordion nor Nested List works here because you have two actions to do: Make a selection, and Expand and Collapse. I haven't tried TreeView but you can check.

In LibreOffice, How do I create two consecutive sets of radio buttons

In LibreOffice Calc, if I create four radio buttons on a Basic dialog, with a tab-order of say 11, 12, 13, 14 then they will be treated as a single four-way group.
If I insert any other active form item, such as another text field, (but unfortunately not a dividing line), in the middle, then I get what I want, which is two distinct groups.
Think:
Q.1: * Yes
* No
Q.2: * Yes
* No
All of the documentation seems to be saying that a group is made by giving each button the same name, but this appears to be out of date or out of context, as the dialog editor simply will not allow them to have the same name.
Giving the buttons in each group two different group names also has no effect.
According to https://wiki.openoffice.org/wiki/Documentation/OOo3_User_Guides/Writer_Guide/Form_controls_reference:
If wizards are on, creating a group box launches the Group Element wizard. This creates a group of option buttons (in which only one may be selected at a time). In most cases, using a group box is the best way to create a set of option buttons.
Typically I use group boxes as recommended here. However, instead of the wizard (LibreOffice wizards often give messy results), I find it easier to create the dialog in the dialog editor and then modify the resulting .xdl file using a text editor.
The important thing is the tab index order, as explained at https://wiki.openoffice.org/wiki/Documentation/DevGuide/Basic/Option_Button:
Note, that option buttons that belong to the same group must have consecutive tab indices. Two groups of option buttons can be separated by any control with a tab index that is between the tab indices of the two groups.
A horizontal line will work if that is what you want. For example, here is an example that has two groups. Notice the tab index of 2 for the horizontal line, which is in between the tab indices of the buttons we want to separate (0 to 1 and 3 to 4).
<dlg:radiogroup>
<dlg:radio dlg:id="OptionButton1" dlg:tab-index="0" dlg:left="52" dlg:top="23" dlg:width="50" dlg:height="12" dlg:help-text="&20.Dialog3.OptionButton1.HelpText" dlg:value="&21.Dialog3.OptionButton1.Label" dlg:group-name="a"/>
<dlg:radio dlg:id="OptionButton2" dlg:tab-index="1" dlg:left="52" dlg:top="46" dlg:width="50" dlg:height="12" dlg:help-text="&22.Dialog3.OptionButton2.HelpText" dlg:value="&23.Dialog3.OptionButton2.Label" dlg:group-name="a"/>
</dlg:radiogroup>
<dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="2" dlg:left="50" dlg:top="70" dlg:width="82" dlg:height="6" dlg:help-text="&28.Dialog3.FixedLine1.HelpText" dlg:value="&29.Dialog3.FixedLine1.Label"/>
<dlg:radiogroup>
<dlg:radio dlg:id="OptionButton3" dlg:tab-index="3" dlg:left="52" dlg:top="74" dlg:width="50" dlg:height="12" dlg:help-text="&24.Dialog3.OptionButton3.HelpText" dlg:value="&25.Dialog3.OptionButton3.Label" dlg:group-name="b"/>
<dlg:radio dlg:id="OptionButton4" dlg:tab-index="4" dlg:left="52" dlg:top="93" dlg:width="50" dlg:height="12" dlg:help-text="&26.Dialog3.OptionButton4.HelpText" dlg:value="&27.Dialog3.OptionButton4.Label" dlg:group-name="b"/>
</dlg:radiogroup>
If you don't like the idea of modifying the .xdl file directly, it is possible to do this in the dialog editor without the wizard by selecting each control and changing the value of the tab order field.

How to select a row by a mouse click on Control List in VC++, MFC development

I am trying to use a control list with a report view to store a file list on a dialog based application like this:
I have two columns on the control list.
The control list I am using is Single Selection - True
My question is how to select the row by a mouse click.
If you just want the click response to be available on the whole line, you can define its extended style to be Full row Select by using:
SetExtendedStyle(GetExtendedStyle() | LVS_EX_FULLROWSELECT);

Lotus xpages: xpage containing multiple views

I have a xpage which contains one big table with 1 row and 2 columns. I created this table to separate the xpage into 2 parts: the left one where I have some buttons and the right one where I want to display some views.
From the container controls I drag a View on the right column, but is there any chance to do this in such a way that 1st button clicked => 1st view is shown, 2nd button clicked => 2nd view is shown and so on.
Or every xpage should contain one view?
I raise this question considering the fact that in Lotus Notes if you had one frameset with 2 frames, you could easily create an outline in one frame, and some views that will be open by every outline entry in the 2nd frame. What I want to do is quite the same thing.
I appreciate your time. If you think this question isn't 'good' enough, I will just delete it. I'm new in XPages development.
Use simple table with one row and two columns. Place your buttons inside the left cell. Put the switch control (mentioned by Tim) to the right one.
More about the control in extlib demo DB... online demo here
Create separate custom control for each view and drag and drop "Include Page" from container control to the right column of your table and compute the page name instead of selecting an XPage. You can compute like this sessionScope.CCName + ".xsp". And onclick of the button set appropriate custom control(which contains the view) name as the value to the sessionScope variable and reload the page. This will do what you want. I hope this too helps.
You could do this on a single XPage using a xe:navigator control in the left column and an xe:dynamicViewPanel control in the right. These controls are available in the Extension Library if you are running 8.5.3 and natively available in release 9.
The Dynamic View Panel control is the dynamic content control for displaying one of several Domino views. Only the component for the displayed view is loaded in the component tree so it is highly efficient compared to alternative designs (like an xp:viewPanel control in each facet of an xe:switchFacet control as each viewPanel is loaded in the component tree on the server, not just the one that is rendered).
See this online demo http://xpages.jp/demos/xpagesext.nsf/Domino_DynamicView.xsp
put each content on a seperate panel in a custom control.
Have those custom controls in seperate divs and show/hide divs based on button click.
If you are using different xpages, you can use IncludePage(from container controls), which will act like a computed subform.

Bring a programmatically selected Item to the visible area in a JSF selectOneListbox

I want to programmatically select an item in JSF selectOneListbox. As there are large number of items and the height is restricted, most of the items are hidden. If I move the slider up and down, I can see the selection, but not other vice. Is there any way to bring the selection to the visible area, like in a Top in VB Listbox?
I used h:selectOneMenu so that selected one is always visible.

Resources