Page 1 of 1

Xbrowse mousewheel and keyboard

Posted: Wed Dec 26, 2007 11:10 am
by Richard Chidiak
Hello

When appending records to a xbrowse, i have very bad display (lines are displayed twice) if i use mousewheel or keyboard (keydown)

If i use the mouse, everything shows normal

Anyone else having this kind of problems ?

Tia

Richard

Posted: Wed Dec 26, 2007 11:27 am
by Antonio Linares
Richard,

Could you please post a little sample to reproduce the error ? Thanks!

Posted: Wed Dec 26, 2007 12:08 pm
by Richard Chidiak
Antonio,

below is a sample i just created,
To reproduce,
set the cursor on Enrico for instance then click on add and add any name, watch the first line
Move the mouse to the first line , see what happens and then watch the last line

Thanks for help,


#include "FiveWin.ch"
#include "xbrowse.ch"

function MAIN()
local oDLG, ;
AADBF := {}, ;
OBRW

REQUEST DBFCDX
Rddsetdefault( "DBFCDX" )

IF FILE("TEST.DBF")
ERASE ("TEST.DBF")
ERASE ("TEST.CDX")
ENDIF
aADBF := {}
AADD(aADBF, {"NAME", "C", 20, 0 })
AADD(aADBF, {"NATIONAL", "C", 20, 0 })
DBCREATE("TEST", aADBF)

USE TEST NEW
INDEX ON NAME TAG "NAME"
TEST->(ORDSETFOCUS("NAME"))

APPEND BLANK
REPLACE TEST->NAME WITH "ANTONIO"
REPLACE TEST->NATIONAL WITH "SPAIN"

APPEND BLANK
REPLACE TEST->NAME WITH "RICHARD"
REPLACE TEST->NATIONAL WITH "FRANCE"

APPEND BLANK
REPLACE TEST->NAME WITH "ENRICO"
REPLACE TEST->NATIONAL WITH "ITALY"

APPEND BLANK
REPLACE TEST->NAME WITH "OTTO"
REPLACE TEST->NATIONAL WITH "AUSTRIA"

APPEND BLANK
REPLACE TEST->NAME WITH "NAGESRAW"
REPLACE TEST->NATIONAL WITH "INDIA"

TEST->(DBGOTOP())

DEFINE DIALOG oDlg RESOURCE "TEST"

oBrw := TXBrowse():New()
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:lColDividerComplete := .t.
oBrw:nColDividerStyle := LINESTYLE_LIGHTGRAY
oBrw:nRowDividerStyle := LINESTYLE_LIGHTGRAY

oBrw:bClrStd := {|| { CLR_BLUE, CLR_WHITE } }

oCol:=oBrw:AddCol()
oCol:bStrData:= {|| TEST->NAME }
oCol:cHeader := "Name"
ocol:nWidth := 200

oCol:=oBrw:AddCol()
oCol:bStrData:= {|| TEST->NATIONAL }
oCol:cHeader := "Nationality"
ocol:nWidth := 200

oBrw:CreateFromResource( 201 )

REDEFINE BUTTON ID 01 OF ODLG ACTION ODLG:END()
REDEFINE BUTTON ID 02 OF ODLG ACTION ODLG:END()

REDEFINE BUTTON ID 03 OF ODLG ACTION ADDBRW(OBRW,ODLG)
REDEFINE BUTTON ID 04 OF ODLG ACTION DELBRW(OBRW,ODLG)

ODLG:bSTART := { || OBRW:SETFOCUS() }

ACTIVATE DIALOG oDlg CENTERED
TEST->(DBCLOSEAREA())
ERASE ("TEST.DBF")
ERASE ("TEST.CDX")
return nil

STATIC FUNCTION ADDBRW(obrw,ODLG)
LOCAL DNAME := SPACE(20), ;
LSAVE := .F., ;
DNATIONAL := SPACE(20)

DEFINE DIALOG ODLG RESOURCE "TESTNAME"

REDEFINE GET DNAME ID 201 OF ODLG
REDEFINE GET DNATIONAL ID 202 OF ODLG

REDEFINE BUTTON ID 01 OF ODLG ACTION (LSAVE := .T.,ODLG:END())
REDEFINE BUTTON ID 02 OF ODLG ACTION (LSAVE := .F.,ODLG:END())

ACTIVATE DIALOG oDlg CENTERED
IF ! LSAVE
RETURN NIL
ENDIF
APPEND BLANK
REPLACE TEST->NAME WITH DNAME
REPLACE TEST->NATIONAL WITH DNATIONAL

OBRW:REFRESH()
OBRW:SETFOCUS()
return nil

STATIC FUNCTION DELBRW(obrw,ODLG)
TEST->(DBDELETE())
TEST->(DBSKIP(-1))
TEST->(DBSKIP(+1))
OBRW:REFRESH()
return nil



TEST DIALOG 4, 13, 358, 247
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 10, "Tahoma"
{
CONTROL "", 201, "tXbrowse", 0 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL, 1, 1, 353, 212
DEFPUSHBUTTON "OK", 1, 2, 225, 42, 21
PUSHBUTTON "Annuler", 2, 315, 225, 42, 21
PUSHBUTTON "Add", 3, 89, 226, 30, 19
PUSHBUTTON "Delete", 4, 239, 227, 30, 19
}
TESTNAME DIALOG 4, 15, 234, 93
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Encaissement Client"
FONT 10, "Tahoma"
{
EDITTEXT 201, 45, 4, 168, 12, ES_UPPERCASE | WS_BORDER | WS_TABSTOP
EDITTEXT 202, 45, 32, 168, 12, ES_UPPERCASE | WS_BORDER | WS_TABSTOP
DEFPUSHBUTTON "OK", 1, 2, 72, 42, 21
PUSHBUTTON "Annuler", 2, 190, 72, 42, 21
CTEXT "Nationality", -1, 2, 29, 38, 18, SS_CENTER | WS_BORDER | WS_GROUP
CTEXT "Name", -1, 2, 4, 35, 12, SS_CENTER | WS_BORDER | WS_GROUP
}

Posted: Thu Dec 27, 2007 2:45 pm
by Antonio Linares
Richard,

Here it seems to work fine. Here you have my EXE, please try to make the error and post a screenshot, thanks! :-)

http://www.hotshare.net/file/26283-3048040f0f.html

Posted: Thu Dec 27, 2007 3:16 pm
by Richard Chidiak
Antonio

It is not working if you use the keyboard (with your exe) keydown or mousewheel

i sent screenshots to your email

Richard

Posted: Thu Dec 27, 2007 3:21 pm
by Antonio Linares
Richard,

I need to know the exact sequence of keystrokes to reproduce it, thanks