Jump to content

Treeview, checkbox and keyboard selection...


Recommended Posts

Hello,

As many people here I wanted to create an easy multi-select treeview.

Maybe that's not the best way to do it (should I use several checkboxes?), but never mind, I think my problem is interesting anyway.

Read and test my following test script and do the following:

1 - Try by making your selections using the mouse only: everything's alright

2 - Try making your selections using the keyboard only (arrows keys to switch between checkboxes and space key to validate): problem are coming

Moreover versions v3.1.0.14 and v3.1.1.56 do behave differently in case 2)...

Is that a bug for you or is my chec/uncheck management so strange?

Test_MultiCheckbx.au3

A good program computing A into B is mostly one that won't crash in all the other cases...
Link to comment
Share on other sites

When you move to item using keyboard the item gets focus and hasn't been checked yet and your else statement checks at that time.

Case Else
                For $iIndex2 = 0 To 6
                    If ($iMsg = $agItem[$iIndex2]) Then
                        If (BitAND(GuiCtrlRead($agItem[$iIndex2]), $GUI_CHECKED)) Then
                            GUICtrlSetState($gOk, $GUI_ENABLE)
                            $iState = $iState + 2^$iIndex2
                            $iChoices = $iChoices + 1
                        Else
                            $iState = $iState - 2^$iIndex2
                            $iChoices = $iChoices - 1
                            If ($iState = 0) Then
                                GUICtrlSetState($gOk, $GUI_DISABLE)
                            EndIf
                        EndIf
                        ExitLoop
                    EndIf
                Next

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

You're absolutely right I knew that but I let it that way for the differences of behavior between v3.1.1.0 (I made a mistake earlier) and v3.1.1.56 to be more obvious.

My point was not this but the following (I should have been more accurate):

For case 2), with v3.1.1.56:

- Launch the script and press TAB key twice => 1st element has the focus

- Press TAB key twice again => you graphically have the focus again BUT $iMsg <> $agItem[$iIndex2] ???

How can that be you receive no message?

Well, anyway, for those who need a multi-selector, here is mine...

Note that in v3.1.1.0, this only really work using the mouse!

Enjoy.

Test_MultiCheckbxOK.au3

A good program computing A into B is mostly one that won't crash in all the other cases...
Link to comment
Share on other sites

Just a small pre-information:

The first event on a treeitem comes up cause then this item is the first time _selected_.

A general monitoring for a focus-change (focus-setting/killing) on a treeview is not implemented yet.

Maybe I can change this 'first-selected-event-fire-on-tab-changing' or delete it.

I will check it out now...

So long :D

Holger

Edit: Ok, the first 'false' focusing message can be deleted.

There is an undocumented value to check for this ( I hate these undocumented things *g* :D ok, do such things too :):evil:

Edited by Holger
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...