@KodeZwerg: Unfortunately, clicking the box undoes the check (attachment)
Im kinda bored (Sundays..), so I thought I will compare asmlists for these 3 solutions
1. Fibonacci: 39 lines with 5 call's and 14 mov's
pushl %ebp
movl %esp,%ebp
subl $16,%esp
pushl %ebx
pushl %esi
movl %eax,%esi
movl %edx,%ebx
leal -16(%ebp),%edx
movl U_$CONTROLS_$$_MOUSE,%eax
call CONTROLS$_$TMOUSE_$__$$_GETCURSORPOS$$TPOINT
leal -16(%ebp),%edx
leal -8(%ebp),%ecx
movl %esi,%eax
movl (%esi),%esi
call *832(%esi)
movl 576(%ebx),%eax
subl %eax,-4(%ebp)
cmpl $16,12(%ebp)
jle .Lj19
leal -8(%ebp),%edx
movb $1,%cl
movl %ebx,%eax
call STDCTRLS$_$TCUSTOMLISTBOX_$__$$_ITEMATPOS$TPOINT$BOOLEAN$$LONGINT
movl %eax,%esi
cmpl $-1,%eax
jng .Lj19
movl %eax,%edx
movl %ebx,%eax
call CHECKLST$_$TCUSTOMCHECKLISTBOX_$__$$_GETCHECKED$LONGINT$$BOOLEAN
testb %al,%al
seteb %cl
movl %esi,%edx
movl %ebx,%eax
call CHECKLST$_$TCUSTOMCHECKLISTBOX_$__$$_SETCHECKED$LONGINT$BOOLEAN
.Lj19:
popl %esi
popl %ebx
leave
ret $12
2. Josh: 45 lines with 7 call's and 18 mov's
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %esi
pushl %edi
movl %eax,%ebx
movl %edx,%esi
movl 8(%ebp),%edi
movl $VMT_$CHECKLST_$$_TCHECKLISTBOX,%eax
call fpc_do_is
testb %al,%al
je .Lj18
movl $22,%edx
movl %ebx,%eax
call CONTROLS$_$TCONTROL_$__$$_SCALE96TOFORM$LONGINT$$LONGINT
cmpl 12(%ebp),%eax
jnl .Lj18
movl $VMT_$CHECKLST_$$_TCHECKLISTBOX,%eax
movl %esi,%edx
call fpc_do_as
movl %eax,%ebx
movl %edi,%edx
call STDCTRLS$_$TCUSTOMLISTBOX_$__$$_GETINDEXATY$LONGINT$$LONGINT
movl %eax,%edi
testl %eax,%eax
jnge .Lj18
movl 896(%ebx),%eax
movl (%eax),%edx
call *132(%edx)
cmpl %edi,%eax
jnge .Lj18
movl %ebx,%eax
movl %edi,%edx
call CHECKLST$_$TCUSTOMCHECKLISTBOX_$__$$_GETCHECKED$LONGINT$$BOOLEAN
testb %al,%al
seteb %cl
movl %ebx,%eax
movl %edi,%edx
call CHECKLST$_$TCUSTOMCHECKLISTBOX_$__$$_SETCHECKED$LONGINT$BOOLEAN
.Lj18:
popl %edi
popl %esi
popl %ebx
leave
ret $12
3. KodeZwerg: 47 lines with 11 call's and 22 mov's (shortest code is in fact the longest, thats a surprise)
pushl %ebx
pushl %esi
pushl %edi
movl %edx,%esi
movl $VMT_$CHECKLST_$$_TCHECKLISTBOX,%eax
call fpc_do_is
testb %al,%al
je .Lj13
movl $VMT_$CHECKLST_$$_TCHECKLISTBOX,%eax
movl %esi,%edx
call fpc_do_as
movl (%eax),%edx
call *1172(%edx)
testl %eax,%eax
jl .Lj13
movl $VMT_$CHECKLST_$$_TCHECKLISTBOX,%eax
movl %esi,%edx
call fpc_do_as
movl %eax,%edi
movl $VMT_$CHECKLST_$$_TCHECKLISTBOX,%eax
movl %esi,%edx
call fpc_do_as
movl %eax,%ebx
movl $VMT_$CHECKLST_$$_TCHECKLISTBOX,%eax
movl %esi,%edx
call fpc_do_as
movl (%eax),%edx
call *1172(%edx)
movl %eax,%edx
movl %ebx,%eax
call CHECKLST$_$TCUSTOMCHECKLISTBOX_$__$$_GETCHECKED$LONGINT$$BOOLEAN
testb %al,%al
seteb %bl
movl $VMT_$CHECKLST_$$_TCHECKLISTBOX,%eax
movl %esi,%edx
call fpc_do_as
movl (%eax),%edx
call *1172(%edx)
movl %eax,%edx
movl %edi,%eax
movb %bl,%cl
call CHECKLST$_$TCUSTOMCHECKLISTBOX_$__$$_SETCHECKED$LONGINT$BOOLEAN
.Lj13:
popl %edi
popl %esi
popl %ebx
ret
All compiled with max optimization with exact same settings.