[lazarus] Recreating ListBox/ComboBox handle in win32
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Aug 28 05:17:20 EDT 2003
On Thu, 28 Aug 2003 00:46:03 -0300
Karl Brandt <pascalive at bol.com.br> wrote:
> Mattias Gaertner wrote:
> > On Tue, 26 Aug 2003 18:23:29 -0300
> > Karl Brandt <pascalive at bol.com.br> wrote:
> <snip>
> >>
> >>The problem is that UpdateSelection and updateSorted are called inside
> >>CreateHandle so this is the sequence:
> >>
> >>LM_SETSORTED -> call RecreateWnd -> call CreateHandle - Send
> >>LM_SETSORTED -> call RecreateWnd -> call CreateHandle ...
> >
> >
> > It can/should be:
> >
> > LM_SETSORTED
> > -> call RecreateWnd
> > -> call CreateHandle
> > -> LM_CREATE
> > -> create sorted like Delphi
> > <-
> > -> LM_SETSORTED
> > <- already set
> >
> > Probably we can remove the LM_SETSORTED call in the LCL on initialize
> > wnd.
> >
>
> We can check the current state of these properties and call recreate
> only if they are different(LCL and Win32).
> But in most cases the check will be useless:
And for the rest we need the check.
> Just after creating the control the Recreate will never be called.
> Afer runtime change, will always be recreated because LCL already check
> if the value is different
Custom controls ported from Delphi can send unneeded messages. It is good
programming practice to check if ReCreate is needed.
> I prefer setting the Sort/SelMode at create handling and removing
> UpdateSorted and UpdateSetSelMode from CreateHandle(TCustomListBox)
> and UpdateSorted from CreateWnd(TCustomComboBox)
> This will avoid the cited redndant check.
Exactly my opinion.
> The only drawback is that gtk intf must be updated (set the Sort/SelMode
> at create handling)
Done.
> I'm sending a patch that works changing the LCL as said above. Tested.
> To work without changing LCL is necessary to do the second check, which
> i can do if you prefer.
>
> It also fixes the order of the items in assign and size issues with
> TCustomListbox
Applied.
Mattias
More information about the Lazarus
mailing list