Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid - DynamicCurrentControl problem
Message
From
04/10/2006 13:25:06
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01159409
Message ID:
01159449
Views:
17
>>>I have a grid where 2 of the columns contain comboboxes. The first column contains a single "type" combo, which has 3 hardcoded choices. The 2nd column contains 3 different combos that match the selected type of the first column. I was hoping to use a DynamicCurrentControl command to set the correct combo based on the value in the first column, but no joy. The form's activate method does correctly set the dynamiccurrentcontrol for a different column (which shows a commandbutton), but i'm missing something w/ the other column that has 3 combos in it. It doesnt error out, but i am not getting the result i expected.
>>>
>>>Form's ACTIVATE method...
>>>
>>>
>>>SELECT tmpfloor
>>>WITH thisform.grdfloor
>>>   .column23.sparse = .f.
>>>   .column23.dynamiccurrentControl = 'IIF( EMPTY(tmpfloor.fn_comment),"CmdBlack","CmdBlue" )'
>>>   .Scrollbars = 3
>>>ENDWITH
>>>
>>>SELECT tmpfloor
>>>WITH thisform.grdfloor
>>>   .column4.sparse = .f.
>>>   .column4.dynamiccurrentControl = 'IIF( tmpfloor.fn_finish = "FLOOR";
>>>           OR EMPTY(tmpfloor.fn_finish),"ComboFloor", ;
>>>           IIF(tmpfloor.fn_finish = "CEILING","ComboCeiling","ComboWall" )) '
>>>   .scrollbars = 3		
>>>ENDWITH
>>>
>>>
>>>In the form's INIT, a method is called that sets up the grid properties...
>>>
>>>
>>>	.column4.controlsource  = "tmpfloor.fn_type"
>>>	.column4.ComboCeiling.ColumnCount  = 1
>>>	.column4.ComboCeiling.ColumnWidths = "120"
>>>	.column4.ComboCeiling.ColumnLines  = .t.
>>>	.column4.ComboCeiling.DisplayCount = 6
>>>	.column4.ComboCeiling.rowsourcetype = 3  &&  - SQL Statement
>>>	.column4.ComboCeiling.rowsource = "SELECT floortype FROM floor ;
>>>                              ORDER BY floortype INTO CURSOR  _cfloorC ;
>>>                              WHERE UPPER(floor.floorfin)='CEILING'"
>>>
>>>	.column4.ComboFloor.ColumnCount  = 1
>>>	.column4.ComboFloor.ColumnWidths = "120"
>>>	.column4.ComboFloor.ColumnLines  = .t.
>>>	.column4.ComboFloor.DisplayCount = 6
>>>	.column4.ComboFloor.rowsourcetype = 3  &&  - SQL Statement
>>>	.column4.ComboFloor.rowsource = "SELECT floortype FROM floor ;
>>>                              ORDER BY floortype INTO CURSOR  _cfloorR ;
>>>                              WHERE UPPER(floor.floorfin)='FLOOR'"
>>>	.column4.currentcontrol = "ComboFloor"
>>>
>>>	.column4.ComboWall.ColumnCount  = 1
>>>	.column4.ComboWall.ColumnWidths = "120"
>>>	.column4.ComboWall.ColumnLines  = .t.
>>>	.column4.ComboWall.DisplayCount = 6
>>>	.column4.ComboWall.rowsourcetype = 3  &&  - SQL Statement
>>>	.column4.ComboWall.rowsource = "SELECT floortype FROM floor ;
>>>                              ORDER BY floortype INTO CURSOR  _cfloorW ;
>>>                              WHERE UPPER(floor.floorfin)='WALL'"
>>>
>>>
>>>
>>>When the form displays, regardless of the value in the "type" combo (1st column), the "currentcontrol" combo in the 2nd column is not predicated on the field referenced in the "dynamicacurrentcontrol" command used in the form's activate. Wondering if i should bail on the SQL statements as the row source and go w/ cursors.
>>
>>Chris,
>>1) I couldn't see where tmpFloor is changing. It's constant, no? (maybe in hidden 1st column).
>>2) Add parentheses around the whole expression (ie: "(iif(...))" )
>>3) Also as I could see it you don't need 3 combos there. One combo would do, no?
>>
>>
>>... WHERE UPPER(floor.floorfin)= iif(empty(tmpfloor.fn_finish),'FLOOR', tmpfloor.fn_finish)"
>>
>>Cetin
>
>Cetin - thanks for the reply. I added the parens around the IIF. Still has issues though. The idea w/ the 3 combos in the one column was to dynamically (via currentcontrol) point to one of them based on the selected value in the other column. So:
>
>Column1 Column2
>Type Choices
>==== =======
>Ceiling Tiles
>Ceiling Panelling
>Floor Asphalt
>Floor Concrete
>Floor Tile
>Floor Marble
>Wall Drywall
>Wall Plaster
>
>In the INIT, i am creating 3 cursors based on what matches with Ceiling, floor, and wall. Those cursors are the recordsources for the combos in col2.

But I mean that. You don't need 3 combos. Just one from that table with a where clause. Requery the combo on oen of lostfocus/valid/interactivechange of 1st combo. 1st has " .. into cursor tmpFloor" right?
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