Obsolescence trop grammée

Pour positionner un rectangle de pseudo focus au-dessus d’une listbox, j’utilise pour le calcul des coordonnées de la cellule divers trucs, dont ceci :
$scrollX_l:=LISTBOX Lire propriété(;“maListbox”;_o_lk position barre déf hor)
$scrollY_l:=LISTBOX Lire propriété(
;“maListbox”;_o_lk position barre déf ver)
Mince, les deux constantes arborent le “o” infamant. Vite la doc pour ne pas perdre la face. Ouf, c’est prévu, désormais il faut dire :
OBJET LIRE DÉFILEMENT(*; nomListbox ; premiereColonneVisible ; premiereLigneVisible)
Là-dessus je passe bêtement un moment avant de réaliser que ça ne peut marcher : quand premiereColonneVisible ou premiereLigneVisible sont partiellement visibles, cette commande ne dit rien des pixels du partiellement, nécessaires au calcul pile-poil (la lisière entre partiellement visible et pas visible est peu prévisible, d’ailleurs.)
Je rate quelque chose ou 4D obsolétise un peu vite ?

I still don’t understand this, why is it obsolete if there isn’t a way to get the information you need?

Has anyone found a way to get the exact position without using the deprecated constants?

: Drew WADDELL

I still don’t understand this, why is it obsolete if there isn’t a
way to get the information you need?
Trash was too wide open, I suppose.

Hello,

According to the https://doc.4d.com/4Dv17R4/4D/17-R4/LISTBOX-Get-property.301-4054544.en.htmldocumentation> you can us https://doc.4d.com/4Dv17R4/4D/17-R4/OBJECT-GET-SCROLL-POSITION.301-4054827.en.htmlOBJECT GET SCROLL POSITION>

Regards

Hi Vincent,
OBJECT GET SCROLL POSITION returns the 1st line / column number fully visible in listbox context. But when that 1st line / column is preceded by a partially visible one, it does not inform about the corresponding pixels. For example, to do https://forums.4d.com/Post//28122303/1/#29552519this hover function>, I had to use LISTBOX Get property and the 2 “obsolete” constants _o_lk hor scrollbar position and _o_lk ver scrollbar position. Maybe you remember in last training were we met, we’ve been shown a nice command doing something similar. But, as long as it’s not released, isn’t it a bit early to deprecate these constants?

Hi Arnaud,

You’re right and for precise positioning, I use the mouse position according to the position and geometry of the listbox. Thanks to CONVERT COORDINATES for managing a widget (form object) in a subform.

I’m actually working on a concept of “class” of widget in 4D with functions to obtain all kind of information with for example, for the listbox, the exact area overfly. Thanks to New Formula …

we’ve been shown a nice command
I don’t remember the name but the token is :C1569.

work in progress …

I think it is possible to at least “get” the coordinates of partially visible lines.

for instance, if you want to place a rectangle over a certain cell,

that may or may not be fully visible you can

$selection is the name of the rectangle.

<code 4D>
C_TEXT($1;$listbox)
C_TEXT($2;$selection)

$listbox:=$1
$selection:=$2

ASSERT(OBJECT Get type(*;$listbox)=Object type listbox)

C_LONGINT($3;$col;$4;$pos)
$col:=$3
$pos:=$4

C_BOOLEAN($visible)

C_LONGINT($x1;$y1;$x2;$y2)
LISTBOX GET CELL COORDINATES(*;$listbox;
$col;$pos;$x1;$y1;$x2;$y2)

OBJECT GET COORDINATES(*;$listbox;$x;$y;$r;$b)
$w:=$r-$x
$h:=$b-$y

$hh:=$y+(LISTBOX Get headers height(*;$listbox)LISTBOX Get property(;$listbox;lk display header))
$y1:=Choose($y1>$hh;$y1;$hh)
$visible:=($y2>$hh)

$hh:=$b-(LISTBOX Get footers height(*;$listbox)LISTBOX Get property(;$listbox;lk display footer))
$y2:=Choose($y2<$hh;$y2;$hh)

OBJECT SET COORDINATES(*;$selection;$x1;$y1;$x2;$y2)

$visible:=$visible & ($pos#0)

OBJECT SET VISIBLE(*;$selection;$visible)
</code 4D>

if you know the line number,

LISTBOX GET CELL COORDINATES allows you get its exact coordinates.

if you know the line number,
Hi Miyako,
LISTBOX GET CELL COORDINATES uses row/column parameters: