craigsboyd
IS-IT--Management
It appears that unless a combobox has an array as it's rowsource and the style set to 2-Drop Down List that it will not display a value that it does not have a corelating item for. I find this behavior a little odd and would appreciate any comments on it. Perhaps I am missing something here. Please run the code below.
Slighthaze = NULL
[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
Code:
PUBLIC oForm
oForm = CREATEOBJECT("clsCombo")
oform.show()
DEFINE CLASS clscombo AS form
Top = 0
Left = 0
Height = 277
Width = 480
DoCreate = .T.
Caption = "COMBOBOX TEST"
Name = "clscombo"
ADD OBJECT combo1 AS combobox WITH ;
RowSourceType = 2, ;
RowSource = "crsFirst", ;
ControlSource = "cNonexistantColor", ;
Height = 24, ;
Left = 24, ;
Top = 60, ;
Width = 132, ;
Name = "Combo1"
ADD OBJECT combo2 AS combobox WITH ;
RowSourceType = 2, ;
RowSource = "crsSecond", ;
ControlSource = "cNonexistantColor", ;
Height = 24, ;
Left = 259, ;
Style = 2, ;
Top = 60, ;
Width = 132, ;
Name = "Combo2"
ADD OBJECT combo3 AS combobox WITH ;
RowSourceType = 5, ;
RowSource = "aryFirst", ;
ControlSource = "cNonexistantColor", ;
Height = 24, ;
Left = 24, ;
Top = 153, ;
Width = 132, ;
Name = "Combo3"
ADD OBJECT label1 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "runs off a cursor drop-down combo", ;
Height = 17, ;
Left = 24, ;
Top = 96, ;
Width = 194, ;
Name = "Label1"
ADD OBJECT combo4 AS combobox WITH ;
RowSourceType = 5, ;
RowSource = "arySecond", ;
ControlSource = "cNonexistantColor", ;
Height = 24, ;
Left = 259, ;
Style = 2, ;
Top = 153, ;
Width = 132, ;
Name = "Combo4"
ADD OBJECT label3 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "runs off an array, drop-down combo", ;
Height = 17, ;
Left = 24, ;
Top = 189, ;
Width = 196, ;
Name = "Label3"
ADD OBJECT label4 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "runs off an array, drop-down combo", ;
Height = 17, ;
Left = 259, ;
Top = 189, ;
Width = 196, ;
Name = "Label4"
ADD OBJECT label2 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "runs off a cursor drop-list combo", ;
Height = 17, ;
Left = 259, ;
Top = 96, ;
Width = 180, ;
Name = "Label2"
ADD OBJECT label5 AS label WITH ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "This is the only one that works the way I expect it to!", ;
Height = 33, ;
Left = 259, ;
Top = 208, ;
Width = 204, ;
ForeColor = RGB(128,0,0), ;
Name = "Label5"
ADD OBJECT label6 AS label WITH ;
AutoSize = .T., ;
FontSize = 14, ;
BackStyle = 0, ;
Caption = "#1", ;
Height = 25, ;
Left = 24, ;
Top = 36, ;
Width = 24, ;
Name = "Label6"
ADD OBJECT label7 AS label WITH ;
AutoSize = .T., ;
FontSize = 14, ;
BackStyle = 0, ;
Caption = "#2", ;
Height = 25, ;
Left = 259, ;
Top = 36, ;
Width = 24, ;
Name = "Label7"
ADD OBJECT label8 AS label WITH ;
AutoSize = .T., ;
FontSize = 14, ;
BackStyle = 0, ;
Caption = "#3", ;
Height = 25, ;
Left = 24, ;
Top = 128, ;
Width = 24, ;
Name = "Label8"
ADD OBJECT label9 AS label WITH ;
AutoSize = .T., ;
FontSize = 14, ;
BackStyle = 0, ;
Caption = "#4", ;
Height = 25, ;
Left = 259, ;
Top = 128, ;
Width = 24, ;
ForeColor = RGB(128,0,0), ;
Name = "Label9"
ADD OBJECT label10 AS label WITH ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "The controlsource for all of these comboboxes is the same: cNonExistantColor", ;
Height = 24, ;
Left = 24, ;
Top = 12, ;
Width = 444, ;
ForeColor = RGB(128,0,0), ;
Name = "Label10"
PROCEDURE Load
PUBLIC cNonexistantColor
PUBLIC ARRAY aryFirst(1), arySecond(1)
cNonexistantColor = PADR("Purple",30," ")
CREATE CURSOR crsGlobal (Color c(25), PrimaryID I)
INSERT INTO crsGlobal (Color, PrimaryID) VALUES ("RED", 1)
INSERT INTO crsGlobal (Color, PrimaryID) VALUES ("GREEN", 2)
INSERT INTO crsGlobal (Color, PrimaryID) VALUES ("BLUE", 3)
INSERT INTO crsGlobal (Color, PrimaryID) VALUES ("YELLOW", 4)
INSERT INTO crsGlobal (Color, PrimaryID) VALUES ("ORANGE", 5)
INSERT INTO crsGlobal (Color, PrimaryID) VALUES ("WHITE", 6)
INSERT INTO crsGlobal (Color, PrimaryID) VALUES ("BLACK", 7)
INSERT INTO crsGlobal (Color, PrimaryID) VALUES ("BROWN", 8)
SELECT * from crsGlobal INTO CURSOR crsFirst
SELECT * from crsGlobal INTO CURSOR crsSecond
SELECT * from crsGlobal INTO ARRAY aryFirst
SELECT * from crsGlobal INTO ARRAY arySecond
ENDPROC
ENDDEFINE
Slighthaze = NULL
[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]