-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed nTop not being incremented in ListBox:hitTest() for no-box dropdown #372
Conversation
* src/rtl/listbox.prg ! fixed nTop not being incremented in ListBox:hitTest() for no-box dropdown * replaced inconsistent references to ::nTop with nTop * renamed variables to better reflect their role
Hey! Isn't one-off for dropdown somehow intentional? Do you have some test-code I could run against Cl*pper? |
Yes the dropdown-specific shift is intentional, I have not removed it, but I modified the condition to make sure no-box dropdown is also affected (which is not the case currently). #include "inkey.ch"
FUNCTION DropdownTest()
LOCAL GetList := {}, loGet
LOCAL laItems := {"One", "Two", "Three", "Four", "Five", "Six"}
LOCAL lcItem := "One"
LOCAL lcItem2 := "Two"
LOCAL lcColor := "W/N,N/W,N/W,W+/R,W/N,R+/N,G+/N,W+/R"
SET EVENTMASK TO INKEY_ALL - INKEY_MOVE // 254
CLS
@ 10, 5, 15, 25 GET lcItem LISTBOX laItems DROPDOWN COLOR( lcColor )
@ 17, 5, 22, 25 GET lcItem2 LISTBOX laItems DROPDOWN COLOR( lcColor )
loGet := ATAIL( GetList )
loGet:Control:hotBox := ""
loGet:Control:coldBox := ""
READ
? lcItem, lcItem2
RETURN ( NIL ) Listbox1 acts as expected, but Listbox2 (no-box) is acting drunk |
nTop++ | ||
ENDIF | ||
|
||
IF ::lIsOpen .AND. .NOT. Empty( ::cHotBox + ::cColdBox ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you could rewrite this line to be IF ::lIsOpen .AND. ! Empty( ::cHotBox + ::cColdBox )
and add some comment/note that here we're extending over Cl*pper's abilites, then I think your patch is okay to be pulled in.
Thank you. The crash looks very similar to the issue I brought up in #371. Clicking anywhere on a borderless dropdown triggers this exact error. Perhaps it was somehow inherited from Cl*pper 🤔 |
2025-01-08 13:14 UTC+0100 Kamil Przybylski (kprzybylski quay.pl)
* src/rtl/listbox.prg
! fixed nTop not being incremented in ListBox:hitTest() for no-box dropdown
* replaced inconsistent references to ::nTop with nTop
* renamed variables to better reflect their role
Explanation:
This caused no-box dropdowns to be off by 1 in calculations.
core/src/rtl/listbox.prg
Lines 411 to 416 in 56bd635
::nTop
andnTop
inconsistently. I changed all referenced tonTop
.nRet
tonOffset
, since it is misleading and isn't even returned by the function.RETURN 0
toRETURN HTNOWHERE
to be more consistant and descriptive.