ListBox Input Field Scrolling........

ListBox Input Field Scrolling........

Postby RiazKhan » Fri Apr 15, 2022 8:51 am

I have a Listbox defined, in which the user inputs data in text..
The variable size is 90 characters, the input field is 40 characters.
Is it possible to have the input text scroll horizontally to get the complete text?
In ListBox....

The blue input field is in focus and the user input to scroll....Is this possible with ListBox..??
OR...just simply increase the row size...???

Any thoughts....

Image
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
User avatar
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: ListBox Input Field Scrolling........

Postby nageswaragunupudi » Fri Apr 15, 2022 8:59 am

Is your listox is XBrowse?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ListBox Input Field Scrolling........

Postby RiazKhan » Fri Apr 15, 2022 9:28 am

The class used in the RES dialog file is TWBrowse...

Source...
REDEFINE LISTBOX oBrw ;
FIELDS aAcc_No[ nItem ] ,;
P6_Mast->(DbSeek(Trim(PadCode1(aAcc_No[ nItem ]))),P6_Mast->Acc_Name) ,;
aAcc_Desc[ nItem ] ,;
If(!Empty(aTrn_AmtD[ nItem ]),TransForm(aTrn_AmtD[ nItem ],'99,999,999,999.99 '),' ') ,;
If(!Empty(aTrn_AmtC[ nItem ]),TransForm(aTrn_AmtC[ nItem ],'99,999,999,999.99 '),' ') ;
HEADERS "G/L Code","Account Title","Description","Debit","Credit" ;
FIELDSIZES 110,235,345,130,130 ;
FONT oFntAE ;
ID 1114 OF oDlg ;
ON CHANGE (P6_Mast->(DbSeek(Trim(PadCode1(aAcc_No[ nItem ])))) ,;
cName:=P6_Mast->Acc_Name ,;
oSay11:Refresh() ,;
oSay21:Refresh() ,;
oSay31:Refresh())

oBrw:nClrForeHead := 0
oBrw:nClrBackHead := 8778750 &&..Cream

//oBrw:bLDblClick:= {|| oBrw:ShowSizes() }

oBrw:nLineStyle:= 3

oBrw:aJustify := { .F.,.F., .F., .T., .T. }

oBrw:bGoTop := { || nItem := 1 }
oBrw:bGoBottom := { || nItem := Len(aAcc_No) }
oBrw:SetArray( aAcc_No, aAcc_Desc, aTrn_AmtD, aTrn_AmtC )
oBrw:bSkip := { |nWant, nOld| nOld:=nItem, nItem+=nWant, ;
nItem := max( 1, min( nItem, eval( oBrw:bLogicLen ))), nItem - nOld }

oBrw:bLDblClick:= {|| W_21AEU(oBrw,nItem,mMode,oDlg)}

oBrw:bKeyDown := {|nKey| If(nKey=13,W_21AEU(oBrw,nItem,mMode,oDlg), ;
If(nKey=46,(W_21AED(nItem), oBrw:SetFocus(.T.)), ;
If(nKey=45,(Empty_Ins(nItem), oBrw:Refresh(), oBrw:SetFocus(.T.), ;
W_21AEU(oBrw,nItem,mMode,oDlg),oSay11:Refresh(),oSay21:Refresh(), ;
oSay31:Refresh()),)))}

oBrw:nClrText := {|| SelColor(1,nItem)}
oBrw:nClrPane := {|| SelColor(2,nItem)}
oBrw:nClrForeFocus := {|| SelColor(3,nItem)}

On key press {Enter].. fuction called ..To edit columns...
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
User avatar
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: ListBox Input Field Scrolling........

Postby RiazKhan » Thu Aug 22, 2024 9:34 am

Need an update on this.....

I have a Listbox defined, in which the user inputs data in text..
The listbox is TWBrowse
The variable filed size is 90 characters
Is it possible to have the input text scroll horizontally to get the complete text?
In ListBox....

Thank & Regards...
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
User avatar
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: ListBox Input Field Scrolling........

Postby Antonio Linares » Thu Aug 22, 2024 2:12 pm

Dear Riaz,

> On key press {Enter].. fuction called ..To edit columns...

What function do you use to edit the cells ?

It could be modified to allow horizontal scrolling
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ListBox Input Field Scrolling........

Postby RiazKhan » Thu Aug 22, 2024 4:40 pm

Hi Antonio, Thank you for your prompt response as always...

Upon KeyPress [Enter] a function is called and each column is editable, HEditCol() is called to get input from user...

The function called to edit column is HEditCol()


Example of Input/editing of Column 3
xDesc is the Input Variable / Size of xDesc is Space(55)
nItem is the Row number


HEditCol(3,@xDesc,"@!",,0,16776960,,,{W_21EC(nItem,2),oBrowse,355,.F.,0,aAcc_Desc})




*---------------------------------------------------------------------------*
FUNCTION HEditCol( nCol, uVar, cPicture, bValid, nClrFore, nClrBack,aItems, bAction, aVarArry )
*---------------------------------------------------------------------------*
LOCAL oDlg, oGet, oFont, oBtn, oBtnAction
LOCAL nWidth,cVar,oBrw,iHelp,WHlp
LOCAL uTemp,aDim,lOk,cHType
LOCAL x,tRtn,DispDesc:=.F.,aDArray:={},aTmpArray:={}

cVar := aVarArry[1]
oBrw := aVarArry[2]
nWidth := aVarArry[3]
iHelp := aVarArry[4]
WHlp := aVarArry[5]

If Len(aVarArry) = 6
aTmpArray := aVarArry[6]
For x = 1 To Len(aTmpArray)
If Empty(aTmpArray[x])
aDel(aTmpArray[x])
Loop
Endif
If aScan(aDArray, aTmpArray[x]) = 0
aAdd(aDArray , aTmpArray[x])
Endif
Next x
DispDesc := If(Len(aDArray)#0,.T.,.F.)
Endif

uTemp := tRtn := uVar
aDim := aBrwPosRect( oBrw:hWnd, oBrw:nRowPos, oBrw:aColSizes, oBrw:nColPos, nCol,;
If( oBrw:oFont != nil, oBrw:oFont:hFont, 0 ) )

aDim[1]:= aDim[ 1 ] + 1
lOk := .f.
cHType := ValType( uVar )

IF oBrw:lCellStyle .And. nCol != oBrw:nColAct
oBrw:nColAct := nCol
If oBrw:oHScroll != nil
oBrw:oHScroll:SetPos(nCol)
Endif
oBrw:Refresh(.F.)
ENDIF

DEFINE DIALOG oDlg FROM aDim[ 1 ], aDim[ 2 ] TO aDim[ 3 ], aDim[ 4 ] ;
STYLE nOR( WS_VISIBLE, WS_POPUP ) PIXEL

IF oBrw:oFont != nil
oFont := TFont():New( oBrw:oFont:cFaceName, oBrw:oFont:nWidth,;
oBrw:oFont:nHeight, .F., oBrw:oFont:lBold )
Endif

@0,0 GET oGet VAR uVar ;
SIZE aDim[ 4 ] - aDim[ 2 ] - If( bAction != nil, 12, 0 ),;
aDim[ 3 ] - aDim[ 1 ] OF oDlg ;
FONT oFont COLOR nClrFore, nClrBack

oGet:oFont := oBrw:oFont
oGet:oGet:Picture := cPicture
oGet:bKeyDown := {|nKey| If(nKey=115,;
( uVar := If(DispDesc,(DispDesc(aDArray,tRtn)),cVar),;
oGet:Refresh(),oGet:SetFocus(.T.)), ;
If(iHelp,If(nKey=114,(uVar:=W_21A1(uVar,WHlp), ;
oGet:Refresh(),oGet:SetFocus() ),),);
)}
If bAction != NIL
@0,0 BUTTON oBtnAction PROMPT "" OF oDlg SIZE 12, 12
oBtnAction:bAction := {|| oGet:VarPut( Eval(bAction,uVar) ),;
oDlg:End(), lOk := .T. }
ENDIF
*
oGet:bValid := bValid
*
@10,0 BUTTON oBtn PROMPT "" ACTION (oDlg:End(), lOk:=.T. ) OF oDlg
oBtn:nStyle := nOr( WS_CHILD, WS_VISIBLE, BS_DEFPUSHBUTTON )

ACTIVATE DIALOG oDlg ;
ON INIT (DlgAdjust(oDlg,oGet,oBtnAction,aDim,cHType), ;
If(iHelp,GetBitMap(oGet,1,WHlp,nWidth,"16_F3"),))

IF !lOk
uVar := uTemp
ENDIF
RETURN lOk
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
User avatar
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests