I use code something like "activate dialog odlg on init ( obrw:gobottom(), obrw:setfocus() )"
This works well if the browse is in dialog but not when the browse is in window. But our requirement is to present the browses in mdi child windows (not in dialogs) because the users want to open two or three accounts simultaneously for comparison.
In the case of dialog the last rows of the data are filled fully in the browse area and the cursor is positioned on the last row. But in the case of window, only the last 2 or 3 lines are displayed at the top leaving the rest of the browse area blank. Here is an example to show the difference in behavior of xbrowse in dialogs and windows.
- Code: Select all Expand view RUN
#include 'fivewin.ch'
#include 'xbrowse.ch'
function main()
local ownd, obar
define window ownd mdi
define buttonbar obar of ownd
define button of obar prompt 'dlg' action xbrdlg()
define button of obar prompt 'win' action xbrwin()
activate window ownd
return nil
static function xbrdlg()
local odlg, obrw
use \fwh\samples\customer new alias cust1 shared
define dialog odlg size 800,600 pixel
obrw := txbrowse():new( odlg )
obrw:calias := 'cust1'
obrw:ntop := 10
obrw:nleft := 10
obrw:nbottom := 290
obrw:nright := 390
// obrw:setrdd()
obrw:createfromcode()
activate dialog odlg centered ;
on init ( obrw:gobottom(), obrw:setfocus() )
close cust1
return nil
static function xbrwin()
local ownd, obrw, calias
calias := cgetnewalias( 'cust' )
use \fwh\samples\customer new alias (calias) shared
define window ownd mdichild of wndmain()
obrw := txbrowse():new( ownd )
obrw:calias := calias
obrw:createfromcode()
ownd:oclient := obrw
activate window ownd ;
on init ( obrw:gobottom(), obrw:setfocus() ) ;
valid ( (calias)->(dbclosearea()), .t. )
return nil
I could find out the reason, but I could not find solution. In case of dialog the browse object knows the correct value of obrw:nheight and consequently the method obrw:brwheight returns the correct value, because we assign the value to data nbottom initially. In case of window, the browse object does not know the correct height information at the time of "on init" of window.
How can this be solved please?