Maxgui: Listbox and initial keydown behaviour?

BlitzMax Forums/BlitzMax Programming/Maxgui: Listbox and initial keydown behaviour?

Krischan(Posted 2015) [#1]
I want to get rid of a annoying "problem". I create a listbox, set the focus on it and preselect the first entry. I would expect that I can press the down key now and the selection bar moves down to the next entry. But it doesn't! You need to press the down key twice - there is no EVENT_GADGETSELECT on the first key press but on the second it is.

How can I get rid of this behaviour? Is this a bug or a Microsoft feature? :-D

Example to play with:



col(Posted 2015) [#2]
I believe its a little bug.

You mention windows...
mod/maxgui.mod/win32maxguiex.mod/win32maxguiex.bmx
Line 2707

EDITED:- On my win7 install I must have a different version to my Win10 install as the code that needs patching is in a different place within the same file :/ go to post #6 for a more definitive way to find the correct code that needs modifying.


Krischan(Posted 2015) [#3]
Thanks col. Unfortunately it doesn't work. I've changed the Method and recompiled the module with no errors. Did you test it in your environment?


col(Posted 2015) [#4]
Uh huh, I tested on windows10, using BMax 1.50.
I can have a look against win7 tomorrow and report back, either way your expectant behaviour should work.


Chalky(Posted 2015) [#5]
I can confirm that col's fix works on Win8.1 - although I had to have 2 goes at modifying the module as I missed the fact that 2 lines need changing ("it.state=LVIS_SELECTED|LVIS_FOCUSED" and "it.stateMask=LVIS_SELECTED|LVIS_FOCUSED") first time round.


col(Posted 2015) [#6]
Krischan
I'm sure that you know what you're doing and I may given skewy instructions in my previous post.

I can confirm that the fix works on my Win10 x64 and Win7 x64 install too.
For a better, more accurate way to find the code that needs modifying follow these instructions.

In the standard BMax eidtor...
1. Using the right hand pane ( the one with the Home,Code, and Debug tabs ), open the following treeview path: Projects->Modules->maxgui.mod->win32maxguiex.mod
2. Double the win32maxguiex.bmx file to load it into the editor.
3. Click the Code tab. Using the treeview again open the following path:TWindowsListBox Extends TWindowsGadget
4. Still in the newly opened tree node - double-click SetListItemState(index,state) method ( no to be confused with the 'SetListItem' method ).
5. Replace the whole SetListItemState method with

6. Rebuild modules

Chalky is correct is that there are only 2 lines that need an extra flag to set the selected list item to be selected and to have focus. The 'selected' flag is for visual appearance, the focus is for the logic.


Krischan(Posted 2015) [#7]
I'm using Blide and assume I know how to change and rebuild a module ;-) I have a batch for rebuilding a specific module but however, I've rebuilt ALL my modules again with Blide and now it is working. Strange. Thanks to all!


Henri(Posted 2015) [#8]
Hi,

when I make changes to modules, normaly 'Build Modules' from MaxIDE is all that is needed. Sometimes - although rarely - one has to do 'Build All Modules' , but that is probably due to a human error (like accidentally pressing 'Build' when focus is in modules source file).

Does your batch file give feedback when everything went ok ?
Has file been saved before building ?

-Henri

Konfutse says: "Assumption is the mother of all mistakes."


Krischan(Posted 2015) [#9]
Normally I try to prevent changes on modules to make my source most compatible. In future I'll always rebuild all modules in Blide to prevent such human errors :-)


Derron(Posted 2015) [#10]
If you use Bruceys BMK it will recompile the modules without a manual trigger.


bye
Ron