A Question about (FiveLinux) Class TWBrowse
Posted: Fri Sep 05, 2008 8:32 am
Hi Antonio
I don't quite know how to do something. Take a TWBrowse. I want to be able to set the default selection to some position other than 1. I can do this by setting oBrw:nAt but the issue is if I set that to record n then records 1 through n-1 aren't displayed. Is there a way around this? To date I have been skirting the issue by re-ordering the arrays that are browsed so the record I want selected as default is in position 1, but I am coming to situations where this is less than desirable. Can you advise?
You can see the issue using the testbrwa.prg program you sent me with the addition of 1 line as follows:
I note that in TDialog there is an intriguing piece of code to do with TListbox objects, namely:
Is this to overcome a comparable issue with list boxes? Is there a way of having an equivalent to SelItem() in TWBrowse?
Regards
Doug
(xProgrammer)
I don't quite know how to do something. Take a TWBrowse. I want to be able to set the default selection to some position other than 1. I can do this by setting oBrw:nAt but the issue is if I set that to record n then records 1 through n-1 aren't displayed. Is there a way around this? To date I have been skirting the issue by re-ordering the arrays that are browsed so the record I want selected as default is in position 1, but I am coming to situations where this is less than desirable. Can you advise?
You can see the issue using the testbrwa.prg program you sent me with the addition of 1 line as follows:
Code: Select all
// Using a browse to display a multidimensional array
#include "FiveLinux.ch"
function Main()
local oWnd, oBrw, aTest := { { "one", "two" }, { "three", "four" } }
DEFINE WINDOW oWnd TITLE "Testing Browses" SIZE 522, 317
@ 2, 2 BROWSE oBrw OF oWnd ;
HEADERS "First", "Second" ;
FIELDS aTest[ oBrw:nAt ][ 1 ], aTest[ oBrw:nAt ][ 2 ]
oBrw:SetArray( aTest )
oBrw:nAt := 2 // this is the line I added to set record 2 as the "default" choice.
@ 28, 2 BUTTON "_Ok" OF oWnd ACTION oWnd:End()
@ 28, 30 BUTTON "Add" OF oWnd ACTION ( AAdd( aTest, { "five", "six" } ), oBrw:SetArray( aTest ), oBrw:GoTop() )
ACTIVATE WINDOW oWnd
return nil
Code: Select all
// Listbox controls initialization workaround
for n = 1 to Len( ::aControls )
if ::aControls[ n ]:ClassName() == "TLISTBOX"
::aControls[ n ]:SelItem( ::aControls[ n ]:nAt )
endif
next
Regards
Doug
(xProgrammer)