* PROMPTFIELDS.TXT * to demonstrate related * tables in a list or combo control * >L< * sample data: clear all create cursor one (aa c(10), bb i) index on bb tag bb create cursor two (bb i, cc c(10)) insert into one values ("red",1) insert into one values ("blue",2) insert into one values ("yellow",3) insert into one values ("green",4) insert into two values (3,"flower") insert into two values (3,"squash") insert into two values (1,"stopsign") insert into two values (2,"sky") insert into two values (1,"fire") set relation to bb into one * test wait window; "okay?"+chr(13)+; "dismiss the browse when "+; "you are familiar with the data" ; nowait browse fields two.cc :h="from Two.DBF", ; one.aa :h="from One.DBF" * here we go: acti screen hide windows all clear local vWidth * test objects: _screen.addobject("mylist","listbox") _screen.addobject("mycombo","combobox") * cosmetics: _screen.ResetToDefault("scalemode") && pixels vWidth = _screen.mylist.width _screen.mycombo.width = vWidth _screen.mycombo.left = vWidth + 3 * here's the trick: _screen.setall("rowsourcetype",6) _screen.setall("rowsource",; "iif(.t.,two.cc,two.cc),"+; "iif(.t.,one.aa,one.aa)") * you see ? * just use an iif() for each * column, and you can use any expression, * not just straight fields from various * tables, for any column you like... * note: the Setall()s and all * this cosmetic junk are not required, * they're just so you see that the * trick works exactly the same way * for both types of base objects * (combo and list). Personally I * think it's not too valuable for * combos unless they are dropdown style. * more cosmetics: vWidth = alltr(str(vWidth/2)) _screen.setall("columncount",2) _screen.setall("columnwidths",vWidth+","+vWidth) _screen.setall("value",1) _screen.setall("visible",.t.) * pop down box, just to show off : mouse click at _screen.mycombo.height/2, ; _screen.mycombo.left+_screen.mycombo.width - 2 ; pixels return