Solved

Need a Drop Down Box

Posted on 2010-08-31
9
479 Views
Last Modified: 2012-05-10
I ran into a Foxpo limitation that I cannot seen to get around.   I need a DROPDOWN list box, something like a combination of Listbox and Combobox, or way to set either up accordingly.

I need the box to display the currnetly selected item in the box, which, in turn, is column 1 of the array that is supply data.  The only items that can be selected are the ones in the list.  No data entry is allowed.  So, anyone got any ideas.
0
Comment
Question by:fmoore0001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 14

Accepted Solution

by:
tusharkanvinde earned 250 total points
ID: 33573740
Check the property Style of the combobox. Change it to 2.
0
 

Author Comment

by:fmoore0001
ID: 33573891
okay tusharkanvinde, that was it!!

One last question. Any way to get both columns to display in the box, even though I only want column to store data?
0
 

Author Comment

by:fmoore0001
ID: 33573916
Ah!  And another thing, if I enter values, I get two columns, but if I use an Array, I get only the second column.  More to these things than I thought.
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 14

Expert Comment

by:tusharkanvinde
ID: 33574081
There is a columncount property and a columnwidths property. ColumnWidths will have a comma separated list of widths of each column.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33574561
In the closed state the combobox will only display the first column anyway. So you better have some expression concatenating what you want to display in the closed state for the first column, then set columnwidth to "0,....", so that this first summary column is not visible while the combobox is dropped down. And put an ID or key value you want to bind to in another column, perhaps the last one rather than the first one (which is reserverd for the summray of course), so you also end the columnwidth with 0 to not display that internal only key value.

simple example:

personID, lastname, firstname

populate the array with rtrim(lastname)+', '#rtrim(firstname),lastname,firstname,personID for each row
with columnwidth set to"0,100,100,0"

Bye, Olaf.
0
 

Author Comment

by:fmoore0001
ID: 33582548
Guys, thanks for the input.

Tusharkanvinde, you got me on the right track.  Alot more to combo boxes then I expected!

Olaf,, I could not get the display to ever work showing the column the way I would like.  The problem is that I am dealing with Fannie Mae codes for submission files, government which themselves may only two or three characters for a complicated description.  I was able to show the first descriptions with a combination of VALUE and ARRAY selections, but since column is the only one that matters for data submission the second column just seems to be beyond my reach.  Too bad.  An improvement will not happen for Foxpro.
0
 

Author Comment

by:fmoore0001
ID: 33582680
You know, I wonder if some makes a replacement for the Foxpro combo box as an Active X contol?
0
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 250 total points
ID: 33587208
The combobox cannot show two columns when closed, but you can combine strings from as many columns you want into the first column. To illustrate this, perhaps some sample code is better than just describing...

By,e Olaf.
Create Cursor curPersons (ID I, Firstname C(50), Lastname C(50))
Insert Into curPersons Values (1,"F","Moore")
Insert Into curPersons Values (2,"Tushar","Kanvinde")
Insert Into curPersons Values (3,"Olaf","Doschke")


With _Screen
   .AddObject("Combo1","Combobox")
   With .Combo1
      .Addproperty("aCombo[1]")
            
      Select Padr(Rtrim(Lastname)+", "+Rtrim(Firstname),100), Lastname, Firstname, ID from curPersons into Array .aCombo

      .Style = 2 
      .Width = 200
      .ColumnCount = 4
      .ColumnWidths = "0,88,88,0"
      .RowsourceType = 5
      .Rowsource = "This.aCombo"
      .Visible = .T.
   EndWith
EndWith    

Open in new window

0
 

Author Closing Comment

by:fmoore0001
ID: 33623795
Thanks, guys
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Annoying text scroll in Textbox 10 105
FOXPRO 2.6 DISTRIBUTION KIT 7 416
TSWEB on windows 7 1 1,159
VFP9 wscript.shell .run won't work with task scheduler 9 617
Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Arrow Electronics was searching for a KVM  (Keyboard/Video/Mouse) switch that could display on one single monitor the current status of all units being tested on the rack.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question