SOLVED. XBROWSE FOCUS PROBLEM FRM RESOURCE

SOLVED. XBROWSE FOCUS PROBLEM FRM RESOURCE

Postby dagiayunus » Sun Aug 18, 2024 1:13 pm

Good evening,

Why xbrowse not getting focus after entering the date?
Solved using WS_TABSTOP in RC file
using CONTROL "Custom control", 4001, "TXBROWSE", WS_TABSTOP

Regards

Code: Select all  Expand view  RUN
#include "fivewin.ch"
#include "dtpicker.ch"
#include "xbrowse.ch"

function Voucher(oWndVchr,oWndMain,oRsVchr,oCn)
    local aGrad       := { { 0.5, METRO_STEEL, METRO_STEEL }, { 0.5, METRO_STEEL, METRO_STEEL } }
    local oBrush,VchDate:=date(),oBrw
    local lNew:=.t.    
    local aVoucher:={{ 0,space(30),0.00,"    ",space(30)}}
                     //ledger id,ledger name, amt, credit/debit, narration
   
    LOCAL oDlg
    SetDlgGradient( aGrad )
    aBlankItem  := oRsvchr:BlankRow()
    set date format "dd/mm/yyyy"
 
  DEFINE DIALOG oDlg RESOURCE "VCHDIAG" SIZE 400,600 TITLE "VOUCHER"
 
 
  REDEFINE SAY ID 100 PROMPT "&Date:" of oDlg
  REDEFINE GET VchDate ID 110 MESSAGE "Voucher Date" of oDlg UPDATE ;
                  ACTION (VchDate := Min( MsgDate( VchDate ), Date()), oBrw:SetFocus() )
 
  REDEFINE xbrowse oBrw   ID 4001 of oDlg DATASOURCE aVoucher;
  COLUMNS 1,2,3,4,5 ;
  HEADERS "Id","Ledger","Amount","Type","narration" ;
  CELL LINES FOOTERS FASTEDIT UPDATE
 
  oBrw:Id:nEditType     := EDIT_GET
  oBrw:ledger:nEditType     := EDIT_GET
 
 
    ACTIVATE DIALOG oDlg ON INIT Sttsbar(oDlg) CENTERED
    //RELEASE FONT oFont, oLarge
    //RELEASE BRUSH oBrush
 
return nil

STATIC FUNCTION Sttsbar( oDlg )
SET MESSAGE OF oDlg;
    TO " ";
    TIME NOINSET 2007
RETURN NIL

static function SaveVoucher()
return NIL
static function EditVoucher()
return NIL
static function DeleteVoucher()
return NIL
 

Code: Select all  Expand view  RUN
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 12.00".

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

VCHDIAG DIALOG DISCARDABLE 6, 18, 394, 238
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU
CAPTION "Voucher Dialog"
FONT 8, "MS Sans Serif"
{
  CONTROL "Date:", 100, "Static", WS_GROUP, 10, 8, 98, 16
  CONTROL "", 110, "SysDateTimePick32", WS_TABSTOP, 8, 20, 60, 14
  CONTROL "Custom control", 4001, "TXBROWSE", 0x00000000, 8, 40, 364, 168
}
 
Regards
Yunus

FWH 21.02
dagiayunus
 
Posts: 85
Joined: Wed Nov 19, 2014 1:04 pm

Re: SOLVED. XBROWSE FOCUS PROBLEM FRM RESOURCE

Postby MGA » Wed Aug 21, 2024 12:48 pm

please try:

ACTION (VchDate := Min( MsgDate( VchDate ), Date()), xSetFocus(oBrw))

/*****************************************************************************************************/
function xSetfocus( oObj )
/*
*/
Local _oWnd, _oTempo

if HB_ISObject( oObj )
_oWnd := oObj:oWnd
_oTempo := ''
DEFINE TIMER _oTempo INTERVAL 10 OF _oWnd ACTION ( oObj:SetFocus(), _oTempo:End() )
ACTIVATE TIMER _oTempo
endif

return(.t.)
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1254
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 72 guests