Possible to CALCULATE a listbox-height ?
Possible to CALCULATE a listbox-height ?
Is it possible to calculate the needed listbox-height
to show ALL items without using a scrollbar ?
I tested to calculate the row-height with the defined font
and 5 and 10 items but getting no exact results
.............
nRowHeight := oListFont:nHeight + 4.8 // font-height + top and bottom-space
nBrwHeight := nRowHeight * LEN( aItems ) // tested with 10 and 5 items
@ 5, 5 LISTBOX oLbx VAR cItem ITEMS aItems ;
SIZE nBrwWidth, nBrwHeight PIXEL OF oDlg
the total height
nDlgHeight := nBrwHeight + 45 ( extra space for the defined button )
-------------
regards
Uwe
to show ALL items without using a scrollbar ?
I tested to calculate the row-height with the defined font
and 5 and 10 items but getting no exact results
.............
nRowHeight := oListFont:nHeight + 4.8 // font-height + top and bottom-space
nBrwHeight := nRowHeight * LEN( aItems ) // tested with 10 and 5 items
@ 5, 5 LISTBOX oLbx VAR cItem ITEMS aItems ;
SIZE nBrwWidth, nBrwHeight PIXEL OF oDlg
the total height
nDlgHeight := nBrwHeight + 45 ( extra space for the defined button )
-------------
regards
Uwe
Last edited by ukoenig on Wed Apr 24, 2019 2:36 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Possible to CALCULATE a listbox-height ?
https://docs.microsoft.com/en-us/window ... itemheight
Read this and related
Read this and related
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Possible to CALCULATE a listbox-height ?
Thank You very much.
It is working now without scrollbars and perfect adjustment adding
#define LB_GETITEMHEIGHT 0x01A1
nItemHeight := oLbx:SendMsg( LB_GETITEMHEIGHT, 0, 0 )
adding bitmaps the browser-hight is calculated with the bitmap-height
even if the normal itemhight > bitmap-height
that means the item-hight is defined with the bitmap-height
the normal item-hight from above = 18
the bitmap-hight = 16
regards
Uwe
It is working now without scrollbars and perfect adjustment adding
#define LB_GETITEMHEIGHT 0x01A1
nItemHeight := oLbx:SendMsg( LB_GETITEMHEIGHT, 0, 0 )
adding bitmaps the browser-hight is calculated with the bitmap-height
even if the normal itemhight > bitmap-height
that means the item-hight is defined with the bitmap-height
the normal item-hight from above = 18
the bitmap-hight = 16
regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Possible to CALCULATE a listbox-height ?
I noticed a problem to SEEK inside a listbox with included images
using the same items without images the seek works
The listbox with images selects position Bbb at opening
typing a, c, d or e the focus goes to top and nothing happens.
regards
Uwe
using the same items without images the seek works
The listbox with images selects position Bbb at opening
typing a, c, d or e the focus goes to top and nothing happens.
regards
Uwe
Last edited by ukoenig on Sun Apr 28, 2019 4:52 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Possible to CALCULATE a listbox-height ?
Dear Uwe,
How you calculate Listbox Height. May I have an example?
How you calculate Listbox Height. May I have an example?
ukoenig wrote:Thank You very much.
It is working now without scrollbars and perfect adjustment adding
#define LB_GETITEMHEIGHT 0x01A1
nItemHeight := oLbx:SendMsg( LB_GETITEMHEIGHT, 0, 0 )
adding bitmaps the browser-hight is calculated with the bitmap-height
even if the normal itemhight > bitmap-height
that means the item-hight is defined with the bitmap-height
the normal item-hight from above = 18
the bitmap-hight = 16
regards
Uwe
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Re: Possible to CALCULATE a listbox-height ?
The calculation with and without images.
( I will post a complete working sample )
regards
Uwe
( I will post a complete working sample )
Code: Select all
#define LB_GETITEMHEIGHT 0x01A1
...
...
...
@ nBtnTop, nBtnleft BTNBMP oBtn OF oDlg ;
SIZE 60, 28 PIXEL 2007 ; // B / H
PROMPT "&Cancel" ;
ACTION oDlg:End() ;
FONT oListFont CENTER BORDER
// calculate the browser-size and dialog-size adjusted to the browser
ACTIVATE DIALOG oDlg ;
ON INIT ( nItemHeight := oLbx:SendMsg( LB_GETITEMHEIGHT, 0, 0 ), ; // get the item-height
IIF( nImgHeight = 0, nBrwHeight := nItemHeight * ( LEN( aItems ) +1), ; // browser-hight NO images defined
nBrwHeight := nImgHeight * ( LEN( aItems ) +1) ), ; // browser-hight WITH images
oLbx:nHeight := nBrwHeight, oLbx:Refresh(), ; // defined browser height from calculation
oDlg:Move( 0, 0, nBrwWidth +23, nBrwHeight + 45, .t. ), ; // adjusted dialog-hight to browser
oBtn:nTop := oDlg:nHeight -50, oBtn:Refresh(), ; // button-vertical-position
oCol:AnchorToCell( oDlg ), oDlg:SetColor( 0, nColor ) ) // connect the sub-dialog to the main xbrowse-cell
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Possible to CALCULATE a listbox-height ?
Dear Uwe,
Thanks so much.
Dutch
Thanks so much.
Dutch
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Re: Possible to CALCULATE a listbox-height ?
Now date-, logical- and numeric fields are supported as well using cell-connection.
Using date-fields the needed size-result belongs to a fixed calculation because
of the wanted 3 buttons.
regards
Uwe
Using date-fields the needed size-result belongs to a fixed calculation because
of the wanted 3 buttons.
regards
Uwe
Last edited by ukoenig on Mon Apr 29, 2019 6:55 am, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Possible to CALCULATE a listbox-height ?
The easiest way to anchor a dialog to a cell is
ACTIVATE DIALOG oDlg ON INIT oBrw:SelectedCol():AnchorToCell( oDlg )
ACTIVATE DIALOG oDlg ON INIT oBrw:SelectedCol():AnchorToCell( oDlg )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Possible to CALCULATE a listbox-height ?
Mr. Rao,
I will post the complete solution
it is the way I'm doing it using :
:bEditBlock := { | nRow, nCol, oCol, nKey | ;
FUNCTION MYCELLDLG( oBrw, nRow, nCol, oCol, nKey, aItems, aImages, nImgHeight, oListFont, nColor )
....
....
ON INIT ( some calculations....
and at the end :
oCol:AnchorToCell( oDlg ) )
RETURN cRet
regards
Uwe
I will post the complete solution
it is the way I'm doing it using :
:bEditBlock := { | nRow, nCol, oCol, nKey | ;
FUNCTION MYCELLDLG( oBrw, nRow, nCol, oCol, nKey, aItems, aImages, nImgHeight, oListFont, nColor )
....
....
ON INIT ( some calculations....
and at the end :
oCol:AnchorToCell( oDlg ) )
RETURN cRet
regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.