Mult-Column Combo Box
Hellow
Dose anybody know how to manipulate Multi-Column Combo box in Forms 6i. for more details check this link. http://home.component1.com/img/flex7screen.jpg
If somebody could do it before .. then please just give me some info.
Regards
Tariq
null
populate list using record group & create record group using query having multiple columns merged together through concatenatio.
Ahmer
Similar Messages
-
Determine the best width for ListCellRenderer - Multi-column combo box
Currently, I am having a multi column combo box. In order for the column to align properly during show popup, I use box layout to do so. However, the short coming for box layout is that, the size for each column is fixed. This makes me have a difficulty, when I have a long string to be displayed. The problem is shown through the following screen shoot.
http://i.imgur.com/4Nfc6.png
This is because in 2nd column,
1) All the 3 rows must be in same size so that they are aligned.
2) But 1st row and 2nd row cell renderer, do not know 3rd row is holding such a long string.
The code (2 files) to demo this problem is as follow. Is there any way the size of the cell will be adjusted automatically? Yet, all the row will be aligned properly.
ResultSetCellRenderer.java
package javaapplication24;
import java.awt.Color;
import java.awt.Component;
import javaapplication24.NewJFrame.ResultType;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.UIManager;
* @author yccheok
public class ResultSetCellRenderer extends javax.swing.JPanel implements ListCellRenderer {
/** Creates new form ResultSetCellRenderer */
public ResultSetCellRenderer() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.X_AXIS));
jLabel1.setText("jLabel1");
jLabel1.setMaximumSize(new java.awt.Dimension(88, 14));
jLabel1.setMinimumSize(new java.awt.Dimension(88, 14));
jLabel1.setPreferredSize(new java.awt.Dimension(88, 14));
add(jLabel1);
jLabel2.setText("jLabel2");
jLabel2.setMaximumSize(new java.awt.Dimension(100, 14));
jLabel2.setMinimumSize(new java.awt.Dimension(200, 14));
jLabel2.setPreferredSize(new java.awt.Dimension(100, 14));
add(jLabel2);
}// </editor-fold>
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration
// Do not use static, so that our on-the-fly look n feel change will work.
private final Color cfc = UIManager.getColor("ComboBox.foreground");
private final Color cbc = UIManager.getColor("ComboBox.background");
private final Color csfc = UIManager.getColor("ComboBox.selectionForeground");
private final Color csbc = UIManager.getColor("ComboBox.selectionBackground");
private final Color cdfc = UIManager.getColor("ComboBox.disabledForeground");
// For Nimbus look n feel.
private final Color nimbus_csfc;
Color c = UIManager.getColor("ComboBox:\"ComboBox.renderer\"[Selected].textForeground");
// Pretty interesting. Applying "c" directly on the component will not
// work. I have the create a new instance of Color based on "c" to make
// it works.
nimbus_csfc = c != null ? new Color(c.getRed(), c.getGreen(), c.getBlue()) : null;
private final Color nimbus_csbc;
Color c = UIManager.getColor("ComboBox:\"ComboBox.renderer\"[Selected].background");
// Pretty interesting. Applying "c" directly on the component will not
// work. I have the create a new instance of Color based on "c" to make
// it works.
nimbus_csbc = c != null ? new Color(c.getRed(), c.getGreen(), c.getBlue()) : null;
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
final Color _csbc = csbc != null ? csbc : nimbus_csbc;
final Color _csfc = csfc != null ? csfc : nimbus_csfc;
this.setBackground(isSelected ? _csbc : cbc);
this.setForeground(isSelected ? _csfc : cfc);
jLabel1.setBackground(isSelected ? _csbc : cbc);
jLabel1.setForeground(isSelected ? _csfc : cfc);
jLabel2.setBackground(isSelected ? _csbc : cbc);
jLabel2.setForeground(isSelected ? _csfc : cfc);
final ResultType result = (ResultType)value;
jLabel1.setText(result.symbol);
jLabel2.setText(result.name);
return this;
NewJFrame.java
package javaapplication24;
import java.awt.Container;
import java.awt.Dimension;
import javax.swing.JComboBox;
import javax.swing.JList;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.basic.BasicComboPopup;
* @author yccheok
public class NewJFrame extends javax.swing.JFrame {
public static class ResultType {
* The symbol.
public final String symbol;
* The name.
public final String name;
public ResultType(String symbol, String name) {
this.symbol = symbol;
this.name = name;
@Override
public String toString() {
return symbol;
/** Creates new form NewJFrame */
public NewJFrame() {
initComponents();
this.jComboBox1.addPopupMenuListener(this.getPopupMenuListener());
this.jComboBox1.setRenderer(new ResultSetCellRenderer());
this.jComboBox1.addItem(new ResultType("Number 1", "Normal"));
this.jComboBox1.addItem(new ResultType("Number 2", "Normal"));
this.jComboBox1.addItem(new ResultType("Number 3", "A VERY VERY VERY VERY long text"));
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jComboBox1 = new javax.swing.JComboBox();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
getContentPane().add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 110, -1));
pack();
}// </editor-fold>
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
final NewJFrame frame = new NewJFrame();
frame.setVisible(true);
private PopupMenuListener getPopupMenuListener() {
return new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
// We will have a much wider drop down list.
adjustPopupWidth(jComboBox1);
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
* Adjust popup for combo box, so that horizontal scrollbar will not display.
* Resize JComboBox dropdown doesn't work without customized ListCellRenderer
* http://www.camick.com/java/source/BoundsPopupMenuListener.java
* @param comboBox The combo box
public static void adjustPopupWidth(JComboBox comboBox) {
if (comboBox.getItemCount() == 0) return;
Object comp = comboBox.getAccessibleContext().getAccessibleChild(0);
if (!(comp instanceof BasicComboPopup)) {
return;
BasicComboPopup popup = (BasicComboPopup)comp;
JList list = popup.getList();
JScrollPane scrollPane = getScrollPane(popup);
// Just to be paranoid enough.
if (list == null || scrollPane == null) {
return;
// Determine the maximimum width to use:
// a) determine the popup preferred width
// b) ensure width is not less than the scroll pane width
int popupWidth = list.getPreferredSize().width
+ 5 // make sure horizontal scrollbar doesn't appear
+ getScrollBarWidth(popup, scrollPane);
Dimension scrollPaneSize = scrollPane.getPreferredSize();
popupWidth = Math.max(popupWidth, scrollPaneSize.width);
// Adjust the width
scrollPaneSize.width = popupWidth;
scrollPane.setPreferredSize(scrollPaneSize);
scrollPane.setMaximumSize(scrollPaneSize);
* I can't find any property on the scrollBar to determine if it will be
* displayed or not so use brute force to determine this.
private static int getScrollBarWidth(BasicComboPopup popup, JScrollPane scrollPane) {
int scrollBarWidth = 0;
JComboBox comboBox = (JComboBox)popup.getInvoker();
if (comboBox.getItemCount() > comboBox.getMaximumRowCount()) {
JScrollBar vertical = scrollPane.getVerticalScrollBar();
scrollBarWidth = vertical.getPreferredSize().width;
return scrollBarWidth;
* Get the scroll pane used by the popup so its bounds can be adjusted
private static JScrollPane getScrollPane(BasicComboPopup popup) {
JList list = popup.getList();
Container c = SwingUtilities.getAncestorOfClass(JScrollPane.class, list);
return (JScrollPane)c;
// Variables declaration - do not modify
private javax.swing.JComboBox jComboBox1;
// End of variables declaration
}Edited by: yccheok on Jan 13, 2011 9:35 AMAre these two lines intentionally or is it just a mismatch?
jLabel2.setMaximumSize(new java.awt.Dimension(100, 14));
jLabel2.setMinimumSize(new java.awt.Dimension(200, 14));
2) But 1st row and 2nd row cell renderer, do not know 3rd row is holding such a long string.There is only one cell renderer for all rows, so no need for the rows to know each other.
To calculate the exact maximum width of column two, you have to check each entry.
If you can do this BEFORE creating the combo, you could do this in a loop similar to this pseudo code
FontMetrics fm= jComboBox1.getFontMetrics(jComboBox1.getFont());
foreach (column2String) {
int length= fm.stringWidth(column2String);
if (length>max) max= length;
}Now you have a max value to dimension jLabel2 in your renderer.
If you don't fill your combo in one go, but rather at runtime, you have to check at each
jComboBox1.addItem(...)
whether the string for label2 is extending the current max, redefine max, and repaint the combo.
This second approach I haven't done so far, but that's how I would try. -
Add a Drop down menu / Combo Box into a specified cell of a multi column lsit box
Hello,
i have a question how to manipulate a cell of a multi column list box in that way that i can add a drop down menu or a combo box in this cell?
Is this possible in LabView?
Thank you!Wow, I took a look at the alternate code posted here at that really takes you through gyration (also a similiar comment I see on Lava) to perform what I've done with a few functions....
See the Pics and attached VI for how its done. KISS, I added an event stucture and changed my first enum case to " " (i.e. a blank) to make it look like the other posted code....
Attachments:
DropDownMenuInABox.vi 18 KB
DropDownMenuInABox_FP.PNG 18 KB
DropDownMenuInABox_BD.PNG 36 KB -
How to extract information in cells of a mult-column list box?
I have multi column list box. At run time this listbox allow me to select entire row (this is fine), how to extract the data from each cell along the selected row? It seems to me that the Multi column Listbox (MCL) is merely a 1D array (I guess index of this 1D array corresponds to row index of the MCL and value of the element corresponds to column index of MCL.)
To extract cell values of the selected row, you can create a property node for the MCL. From this property node, choose "Item Names". This is a 2D array containing all cell values. Index this array with the MCL terminal. Note that you must choose the scalar data type for the MCL. To choose the scalar data type, right click on the MCL and go to "Selection Mode"->"Data Type"->"Scalar".
See attachment written with LabVIEW 6.
I hope it will help you.
Attachments:
MCL.vi 15 KB -
How can I create a multi-line combo box?
I am using Adobe Acrobat Pro 9 and I am trying to create a multi-line combo box on my fillable form. At the bottom of this form/letter I would like to have a several paragraps that the user can choose from, but it's only allowing me to enter one line at a time. Any help??
Hi, Did you find the answer to this? I'm looking to create a combo box with multi-lines
-
How to get the index of Mult column list box
Hello all,
I need small help. Please help me.
Is there is any property to change the "Multi column list box" row index position dynamically?
I want to change the index position at runtime like below.
Munna
Solved!
Go to Solution.It's called Top Left Visible Cell. There aren't that many properties there.
Try to take over the world! -
How to insert data to the specified row column of the multi column list box
Hi All
How do i insert data into the specified column of the multi cplumn list box?
I have a table that containsall station nos and name.Then another table contains the data the various stations having at for 24 hrs.That is 12 am to 11 pm.
And i want to display each stations details as follows using a multi column list box/table
My stationinfo table
stnno stnname......................
s1 stn1
s2 stn2
s3 stn3
The other table
stnno sysdatetime data
s1 12am 1
s2 12am 4
s1 1 am 2
So the station s1,s2.... will have data for 24 hrs.
And i want to display it as follows using a multicolumn listbox
stnname 12am 1 am ......................................11pm
s1 ...................
s2 ........................
What i have in my mind is to get all station nos
and in a for loop get the station's data from 12 am to 11 pm
or
select every statios data for each hor.But in this case i have to query the database 24 times.So i dont think its a good way.
Or any other better query available?
Can anybody suggest me a good idea?
One more thing...how to insert data into the specified field row or column of a multi column list box?
Thanks in advancehi
i want to know,,can u say ur need clearly...and i attached two image u see that one
Indrajit
| [email protected] | [email protected] .
Attachments:
station.JPG 35 KB
station2.JPG 79 KB -
How to prevent multi-column list box showing an extra column
I am using a multi-column list box to display data and to allow the user to enter new values. More columns are used than are actually displayed within the bounds of the listbox control. Using an event structure the user is able to scroll left and right along the columns of the list box to select the appropriate field. I am using the 'Edit Position' property to highlight the particular field that the user is selecting. This technique works well and the listbox scrolls left and right to display the selected fields correctly.
If the listbox has, say, 10 columns with only 5 being visible within the displayed width, then I clamp the Edit Position to a maximum column value of 9 to prevent the list box from continuing to scroll right into unused columns. This works fine, except that when the user scrolls to the 10th column, the listbox control always shows a blank 11th column. The 11th column cannot be selected. It would appear that this is default behaviour for the listbox control in that an additional column is always displayed relative to the Edit Position. In my particular application it is untidy to have this blank column appearing. I have tried a workaround by programmatically writing to the 'TopLeft' property of the listbox. This partially works by ensuring that the blank 11th column is never displayed, however, despite the Edit Position being correct to select the 10th column, the field in the 10th column is no longer highlighted and the user cannot enter a new value.
Does anyone know of a method for preventing the blank additional column from appearing?Ok - I have attached an example which demonstrates the issue. This is produced with LV 2012. Open the project and then the 'Multi column listbox.vi'. Run the vi and use the right/left arrows to move between cells in the listbox. Observe that unused (unwanted) columns are always displayed to the right.
Thanks for any help..
Attachments:
Test Multi column listbox.zip 62 KB -
Combo Box Edits in acrobat Forms, how to do a multi-line combo box?
Could only create a one-liners for this editable combo box, is there a way to create a multi-line like the other fields?
Nope. But you can set up a multiline text field that gets populated with the complete text you want when an item is selected from a combo box.The combo box items might be abbreviated or coded versions of the complete text you want to display.
-
I was using a muticolumn listbox(not table,for table i have example code,and problem is that i was not getting active cell position for Multi column listbox) with 5 columns.In third column,i want to generate a ring control,generate in the sense,whenever user clicks on any cell of third column of multicolumn listbox(not table),the ring control should pop up.The thing is that i need to use only one ring control and whenever user clicks on any cell of a third column,this ring control should pop up.How can i achieve this,anyone please help me,
Regards,
Naresh.NHi, Naresh,
For starting point you can read this: Table with Drop Down Items
Andrey. -
Filling a multi-column list box with a query
Hi folks!
I'm really very unexperienced with Oracle Forms so I wasn't able to implement the following problem. I have got a database table called 'employees' with the columns 'id', 'firstname', 'lastname'. In my form I would like to have a listbox containing all the entries of this table (based on a select ... from employee) but with only 2 visible columns (firstname and lastname).
My first question is, how to fill the list with the values from the query. The second question is, when the user selects an entry of the list (an employee), how can I get the ID of this employee?
I hope you can help me!
Thanx in advice
IngoA list item can have only two columns - one shown to the user and one invisible one which actually populates the item. In order to display your names you need to concatenate them into one.
Create a record group with the query:
select firstname||' '||lastname, id from employees
then in a suitable trigger (eg when-new-form-instance)
call POPULATE_LIST(list, recordgroup) -
How to justify text vertically in multi-column frame
How do I justify text vertically in a multi-column frame but within the baseline grid?
Working at a very busy publication, fitting text evenly in multi-column text boxes are crucial to be done quickly! I understand that it can be done manually by adjusting the tracking in order to force the text to end evenly on bottom. However I'm looking to achieve that result automatically, pretty much like the "Justify Vertically" feature except by doing so it spreads the last column lines out, but I need to keep the text on the grid.You can ask over in scripting: InDesign Scripting
-
Use Combo Boxes and Datepart "m" and "y" to filter forms and reports
I am trying to build a Form to filter through Sales Order Records going back up to four years to find purchasing patterns of customers and to find more potential sales. I am using a simple main form, with 2 subforms joined on the Sales Representative
[accntrep], one which show current orders for a given month and the other orders from past months and years. I've got 3 combo boxes, 1 to select sales representative, 1 to select a month using date part and 1 to select a month. This would be very
flexible in easily searching any month in any year of the recordset. I know I will be using something like "DatePart("m",[Date])=2 And Year([Date])=Year(Date())-4" (Feb 2011) to filter my records, but I am having troubling writing
the procedure just right. I am using 2-column combo boxes 1 column for text i.e (April, May, June etc.) and a second for the Date Part Expression. I think I need to concatenate the values into the filter, but I cannot come up with exactly how to
get this done. Any ideas??
Thanks,
jsIf there is any doubt in your mind then I will suggest a sanity debug trick; temporarily add 2 textboxes
in T1 put its control source: =ComboBoxNameMonth
in T2 put its control source: =ComboBoxNameYear
don't put what I typed - put in their actual control names for those 2 comboboxes
this way you can see what is actually the value of those combo boxes... depending on what they are bound to - those values may not be what you are expecting them to be.....obviously alter the properties of the comboboxes until they have the values they should
Am a little unclear on filtering your records in regard to how the data is not structured whether for example: Nov 2015 is in 2 separate fields or a single field like 11/2015 or what - not sure it is a true date field or possibly a text field...so
the next part of this depends on the data structure. -
Hi there,<BR><BR>When putting Combo Box Subscriptions onto Analyzer reports is there any way to ONLY show members that have data held againt then?<BR><BR>For example:<BR><BR>Multi level combo box....<BR><BR>1st Level: Name<BR><BR>2nd Level: Accounts<BR><BR>When selecting the name, can we only show accounts that have data against them? SOmetimes there maybe upto 1,000 accounts held against a name, but only 2 of them have any data held against them, so its a bit of a waste!<BR><BR>The excel spreadsheet addin does this fine by using suppress 0 or #Missing values, can we do the same for COMBO BOXES in Analyzer (not charts, spreadsheets etc..)<BR><BR>Cheers
Thanks for the reply mate. It was a bit of a long shot but no harm in askin <img src="i/expressions/face-icon-small-wink.gif" border="0"><BR><BR>Your idea sounds very useful and will give it a whirl.<BR><BR>Thanks again! <img src="i/expressions/beer.gif" border="0"><BR><BR><blockquote>quote:<br><hr><i>Originally posted by: <b>garycris</b></i><BR>I have not seen that functionality. It would be nice. But since a combo box is dimension specific and you would need to evaluate the intersections of that dimesnion with every other dimension to determine if in fact it was a NULL value being returned, I can see where it could pose some issues. To get around it, I usually put the top member in the drop down with children (descendants, etc) seelcted and then move the dim onto the rows and use Suppress Missing. When they select from the drop down they only get the ones that have values and then I tell them to use right click keep only for the one they want.<hr></blockquote><BR><BR>
-
Needs multi column dynamic combo box using C#
I need a dynamic Combo box to display multi columns on Drop Down Event
such as Stock Code, Make, Model,Sub Model, Measurement Type and so on for my C# Application with Columns Headers
Please Help Me
Thanks in AdvanceYou should create a class that represents your model and then you could use a CompositeCollection as the ItemsSource of the ComboBox.
Here is an example for you:
namespace WpfApplication59
public class YourModel
public string StockCode { get; set; }
public string Model { get; set; }
//+ the rest of your properties
MainWindow.xaml.cs:
public partial class MainWindow : Window
public MainWindow()
InitializeComponent();
List<YourModel> models = new List<YourModel>();
models.Add(new YourModel() { Model = "m1", StockCode ="c1"});
models.Add(new YourModel() { Model = "m2", StockCode = "c2" });
cb.ItemsSource = models;
MainWindow.xaml:
<ComboBox x:Name="cb" Grid.IsSharedSizeScope="True" ItemsSource="{DynamicResource items}"
xmlns:local="clr-namespace:WpfApplication59">
<ComboBox.Resources>
<CompositeCollection x:Key="items">
<ComboBoxItem IsEnabled="False">
<Grid TextElement.FontWeight="Bold">
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="A"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition SharedSizeGroup="B"/>
</Grid.ColumnDefinitions>
<Grid.Children>
<TextBlock Grid.Column="0" Text="Model"/>
<TextBlock Grid.Column="2" Text="Stock Code"/>
</Grid.Children>
</Grid>
</ComboBoxItem>
<Separator/>
<CollectionContainer Collection="{Binding Source={x:Reference cb}, Path=DataContext}"/>
</CompositeCollection>
<DataTemplate DataType="{x:Type local:YourModel}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="A"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition SharedSizeGroup="B"/>
</Grid.ColumnDefinitions>
<Grid.Children>
<TextBlock Grid.Column="0" Text="{Binding Model}"/>
<TextBlock Grid.Column="2" Text="{Binding StockCode}"/>
</Grid.Children>
</Grid>
</DataTemplate>
</ComboBox.Resources>
</ComboBox>
You could restyle the the templates (Grids) as per your requirements.
Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question.
Maybe you are looking for
-
Impact of reinstalling the SUP role at the Central server
Hi Experts Env: 1 Central Server 15 Primary servers 1 WSUS Server Multiple Active update sources (all primary servers) We have identified an issue with multiple WSUS update sources in the database. This is from a previous WSUS installation where in t
-
How to use keyword tags effectively in pse 8
No matter what I try, have not been able to make keyword tags work effectively. Have followed all directions from books and others. Even customer support was not able to help. The problem is that tagged photos will not show up by themselves. All othe
-
How do i completly center my swf in the middle of the page?
ok i made a flash, but it wont center to the middle of my page it centers horizontally on the top, but it wont vertically center to the middle of the page... what am i doing wrong? (please post a html fix for this problem with maybe a explaintaion wi
-
Uninstall wireless mighty mouse driver from OS X / Powermac?
Well, I am one of the (few?) that has had a disappointing experience with the new wireless Mighy mouse - it's slow and sluggish, and darn right unusable on my Powermac G5 - and with the drivers off the CD installed. (My MX 1000, even my old original
-
hi i develop an indesign extension with CS extension builder 2 and flashbuilder 4.6. how to unthread text frames ? i don't find any method or property in textframe class... thanks Simon