Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Peculiar Array/Combo-box problem
Message
From
30/05/2003 07:41:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
30/05/2003 07:20:35
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00794422
Message ID:
00794439
Views:
13
If this is your problem, uncomment init code :
oForm = CreateObject('myForm')
oForm.Show
Read events

Define Class myForm As Form
  DataSession = 2
  Top = 0
  Left = 0
  Height = 271
  Width = 411
  DoCreate = .T.
  Caption = "Combo test"
  Name = "frmMyForm"
  Dimension arrItems[1]

  Add Object combo1 As ComboBox With ;
    BoundColumn = 2, ;
    ColumnCount = (Alen(Thisform.arrItems,2)), ;
    RowSourceType = 5, ;
    RowSource = "thisform.arrItems", ;
    ControlSource = "table1.lookupid", ;
    FirstElement = 1, ;
    Height = 24, ;
    Left = 36, ;
    NumberOfElements = (Alen(Thisform.arrItems)), ;
    Style = 2, ;
    Top = 12, ;
    Width = 144, ;
    BoundTo = .T., ;
    Name = "Combo1"

  Add Object grid1 As Grid With ;
    Height = 200, ;
    Left = 36, ;
    Top = 48, ;
    Width = 320, ;
    Name = "Grid1"


  Procedure Load
    Create Cursor Table1 (Id i, lookupid i)
    For ix = 1 To 100
      Insert Into Table1 Values (ix, Rand()*1000)
    EndFor
    locate

    Select 'Item_'+Transform(lookupid), lookupid ;
      from Table1 ;
      into Array This.arrItems
  EndProc
   Procedure Init
*    this.combo1.NumberOfElements = Alen(This.arrItems)
   EndProc

  Procedure grid1.AfterRowColChange
    Lparameters nColIndex
    Thisform.Refresh
  EndProc
  Procedure QueryUnload
    Clear events
  endproc
Enddefine
Cetin

>Actually, although it displays an item now, it isn't the correct one, I have 2 items in the array, and it's always the first one that displays??
>
>Now I'm really lost!
>
>Kev
>
>
>>>>>Hi
>>>>>
>>>>>I have a Combo-box bound to an Integer field in a cursor, and it's source is a 2-dimensional array under my application object. BoundColumn is 2, ColumnCount 2 etc.etc.
>>>>>
>>>>>However, whenever I fire up the form the combo-box does not recognise the source and doesn't display a value in the combobox!!
>>>>>
>>>>>Any ideas?
>>>>>
>>>>>Thanks
>>>>>Kev
>>>>
>>>>BoundTo = .f. ?
>>>>Cetin
>>>
>>>But it shouldn't be? Ah, that's fixed it :-)
>>>
>>>Thanks very much
>>>Kev
>>You're faster :)
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform