News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

64 bit combo box issue..no data showing

Started by mikeburr, June 13, 2022, 09:02:56 PM

Previous topic - Next topic

mikeburr

Im having problems (64bit) loading a combo box
Nothing is showing in the boxes despite apparantly loading and incrementing the indices correctly
I'm sure it's a fairly simple explanation ...the edit boxes all show default data fine

a summary of the output

;;;;;;;;;;;;;;;;
combo boxes [ nothing showing in boxes

0h : CB_SETEXTENDEDUI .. A value of TRUE selects the extended user interface.. use arrow or F4
              set to TRUE  .. use arrow

then add string data

index   box        box      data         window  data
(rax)     id       handle   location      handle  inserted

0h      1520      180A9Eh  148F2583510h  9B0B2Ah Value 1
1h      1520      180A9Eh  148F2583920h  9B0B2Ah Value 2
2h      1520      180A9Eh  148F2583D30h  9B0B2Ah Value 3
0h
0h      1521      8B15C8h  148F2584140h  9B0B2Ah England
1h      1521      8B15C8h  148F2584550h  9B0B2Ah France
2h      1521      8B15C8h  148F2584960h  9B0B2Ah Ireland
3h      1521      8B15C8h  148F2587230h  9B0B2Ah Italy
4h      1521      8B15C8h  148F258A750h  9B0B2Ah Scotland
5h      1521      8B15C8h  148F2589B20h  9B0B2Ah Wales
0h
0h      1522      1B0E96h  148F258AF70h  9B0B2Ah Argentina
1h      1522      1B0E96h  148F2589F30h  9B0B2Ah Australia
2h      1522      1B0E96h  148F2587690h  9B0B2Ah Fiji
3h      1522      1B0E96h  148F2587AA0h  9B0B2Ah Japan
4h      1522      1B0E96h  148F25882C0h  9B0B2Ah New Zealand
5h      1522      1B0E96h  148F258A340h  9B0B2Ah Samoa
6h      1522      1B0E96h  148F258AB60h  9B0B2Ah South Africa
.........................
edit boxes [ these all show fine with a qualification below]

1h  9B0B2Ah  5E5h 9           
1h  9B0B2Ah  5E6h 0           
1h  9B0B2Ah  5E7h 9           
1h  9B0B2Ah  5E8h 0           
1h  9B0B2Ah  5E9h 0           
1h  9B0B2Ah  5EAh 0           
1h  9B0B2Ah  5EBh 0           
1h  9B0B2Ah  5ECh P 0     [letter P is shown lower case .. shd be upper case .. why ?? ]     
1h  9B0B2Ah  5EEh Comp Page 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
the assembler code
combo box
   loop start
              mov rdx, WS_BOX_ID
              mov r8, offset genWinHandle16 
              mov rcx, [r8]
              lea rax, [rcx + 1] ; test window handle limit 32 bit eqvt ????
      test    rax, 0FFFFFFFFFFFEFFFFh
      je      GenMakeComboBoxDefaultDataerror             
          call GetDlgItem
      test    rax, rax
      je  GenMakeComboBoxDefaultDataerror
     
          ;  mov rcx, WS_WORKHANDLE ;[this is a stored value the same as rax ]

            mov rcx, rax            ; result of getdlg
            mov r9, GenHdataStructure.GenHDS_data
            add r9, r10_save
            mov r9_save, r9
            mov r8, WC_DATA_COUNT
                        ;  mov r8, -1 ; also teated
            mov rdx, 14Ah             ; CB_INSERTSTRING
                        ;  mov rdx, 151h ; CB_SETITEMDATA  also tested
                        ;  mov rdx, 143h ; CB_ADDSTRING  also tested
     
          call SendMessage
         
    get next pointer [ all working fine]
    retrun to loop
   
error routine etc

[this is effectively the same code as SendDlgItemMessage)
......................
edit box [ all working fine except odd capital P exception]


              mov r8, offset genWinHandle16 
              mov rcx, [r8]
             
              mov rdx, WS_BOX_ID
             
              mov r8, GenHdataStructure.GenHDS_data
              add r8, r10_save
              mov r9,FALSE ; unsigned numbers
          call SetDlgItemText
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
box definitions

combo box

  [ extra style]
      mov rax, WS_EX_ACCEPTFILES
      mov WC_BOX_EX_STYLE, rax 
  [ style] 
      mov rax,CBS_DROPDOWNLIST
      or rax,CBS_HASSTRINGS     
      or rax,CBS_AUTOHSCROLL
      or rax,WS_CHILD
      or rax,WS_OVERLAPPED
      or rax,WS_VISIBLE
      mov WC_BOX_STYLE,rax

.............................

edit box
   [ extra style]
      mov rax, WS_EX_CLIENTEDGE
      mov WC_BOX_EX_STYLE, rax
  [ style]
      mov rax,ES_LEFT   
      or rax,ES_AUTOHSCROLL
      or rax,WS_CHILD
      or rax,WS_VISIBLE 
      or rax,WS_BORDER
      or rax,WS_TABSTOP
      mov WC_BOX_STYLE,rax

hutch--

Mike,

Just out of curiosity I tried the following code with a combo box and nothing changed.

rcall SendMessage,hCombo,CB_SETEXTENDEDUI,TRUE,0

Add string like this.

        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 1"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 2"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 3"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 4"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 5"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 6"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 7"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 8"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 9"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 10"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 11"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 12"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 13"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 14"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 15"
        rcall SendMessage,hCombo,CB_ADDSTRING,0,"String 16"

mikeburr

Yes Steve.. thats exactly ( pretty much what I'm doing) and yet although the indexes are showing it loading there's no display..almost the same thing on edit boxes works fine ...I just can't see for looking ..it must be obvious but I'm not getting it ..
There's no point in putting the whole program up as it's bloody enormous ..loads the 16 or so screens and menus from a comma delimited list..the data is also part of this stream and linked to the boxes in each 'dialog' ..its this data being loaded..the data is fine and the method the same for loading edit boxes ..its prob something really trivial
Regards mikeb

jj2007

No complete code, no error checking... good luck :thumbsup:

Full working code attached, source and exe (assembled with ML64) :cool:

cbStyle=WS_VISIBLE or WS_CHILD or CBS_DROPDOWNLIST or CBS_HASSTRINGS
ID_COMBO=111
jinvoke CreateWindowEx, WS_EX_CLIENTEDGE, Chr$("combobox"), NULL, cbStyle, 0, 0, 1, 1, hWnd, ID_COMBO, wcx.hInstance, NULL
mov hCombo, rax ; you may need this global variable for further processing
xor rsi, rsi
  @@: jinvoke SendMessage, hCombo, CB_ADDSTRING, 0, Str$("String %i", rsi)
inc rsi
cmp rsi, 20
jb @B

mikeburr

Ps I've tried cb_addstring..obviously using 0 subscript..with definition hamstrings etc ..and also without using cb line ( zero based) ..you ed have thought it wasn't finding the link to the data etc..but the op is from displays straight after using the same technique ..so it obviously is..I even tried using fixed data description as a one off..nothing

hutch--

Mike,

Here is a simple demo that should get you going.

mikeburr

Its nothing to do with the code..its the definition of the window..either the registration or create..although it has the look of a combo box
Regards mikeb

jj2007

And all your API invokes always return zero for GetLastError? That is really weird :rolleyes:

mikeburr

OK so something bizarre is going on ..I replicated both yours Steve..and jj  create insert..same result ..nothing
I'm using a call  & rsp + etc for the create ( which is generating the window handle correctly )  and the sendmessage is fast call so I can't see where the error is atm
Regards mikeb

mikeburr

no the return codes from the sendmessage are the rax column and correspond to the combo box index .. impying its working .. but the combo box even when i hard code in a string as in steves example isnt showing [it ought to appear replicated  on several lines in fact] .. so i copied your definitions etc still no joy... i have a facility in the program to download the box details .. style and extra style etc and everything is fine .. also it cant be the data location etc as i used a display with exactly the same info to get the column results shown .. ive been trying variants of this for 5 days .. its driving me b..y mad
regards mike b
i might have to post the program or rather a cut down version

jj2007


mikeburr

OK I've solved it..everything is working as it should..
The reason nothing shows is..
Firstly the combo box definition of size needs to be significantly larger than a single edit box size ..I had defined the box 25 units deep where about 75 minimum is required..
Also nothing shows in the combobox until a selection is made..
If the number of selections exceeds the " units allocated" eg 30 selections but only a small pop up list area defined (75 units) then disablenoscroll and hasstrings are required
A default can be shown in the original box ( this is partly how I found everything working)
The default is shown by first sending the equivalent of a SetDlgItemText..
I this resides in user32.dll and will be found to consist of GetDlgItem followed by  SetWindowText..
So in my instance since I have established the (child) window handle and saved it I simply needed to use SetWindowText first to establish a default
Many thanks for the help ..perseverance pays off
Regards mike b
Ps where the list is longer than the units allocated no scroll bar shows ( unless you ownerdraw and build the box) so using the up down keys are necessary to scroll it ...this maybe seems a bit feeble on the part of the designers  but I can understand why it's simplistic