News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Vertical Scroll fot listbox

Started by Farabi, May 25, 2010, 03:25:14 AM

Previous topic - Next topic

Farabi

How to activate vertical scroll bar for listbox?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

MichaelW

Specify the WS_VSCROLL style, possibly combined with LBS_DISABLENOSCROLL?
eschew obfuscation

Farabi

Quote from: MichaelW on May 25, 2010, 09:01:28 AM
Specify the WS_VSCROLL style, possibly combined with LBS_DISABLENOSCROLL?

I did, but the vertical scroll did not appear when the text is more than what displayed. What mistake I did?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

MichaelW

It works for me:

;==============================================================================
    include \masm32\include\masm32rt.inc
;==============================================================================

LBADDS MACRO h,s
  invoke SendMessage, h, LB_ADDSTRING, 0, reparg(s)
ENDM

;==============================================================================

IDC_LST1  equ 101
IDC_LST2  equ 102
IDC_BTN1  equ 103
IDC_BTN2  equ 104

;==============================================================================
    .data
      hwndLst1 dd 0
      hwndLst2 dd 0
    .code
;==============================================================================

DlgProc proc hwndDlg:dword, uMsg:dword, wParam:dword, lParam:dword

    SWITCH uMsg

      CASE WM_INITDIALOG

        invoke GetDlgItem, hwndDlg, IDC_LST1
        mov hwndLst1, eax
        invoke GetDlgItem, hwndDlg, IDC_LST2
        mov hwndLst2, eax

      CASE WM_COMMAND

        SWITCH wParam

          CASE IDCANCEL

            invoke EndDialog, hwndDlg, 0

          CASE IDC_BTN1

            LBADDS hwndLst1, "XXXXXXXXXXXXX"
            LBADDS hwndLst2, "XXXXXXXXXXXXX"

          CASE IDC_BTN2

            invoke SendMessage, hwndLst1, LB_GETCOUNT, 0 ,0
            dec eax
            invoke SendMessage, hwndLst1, LB_DELETESTRING, eax, 0

            invoke SendMessage, hwndLst2, LB_GETCOUNT, 0 ,0
            dec eax
            invoke SendMessage, hwndLst2, LB_DELETESTRING, eax, 0

        ENDSW

      CASE WM_CLOSE

        invoke EndDialog, hwndDlg, 0

    ENDSW

    xor   eax, eax
    ret

DlgProc endp

;==============================================================================
start:
;==============================================================================

    Dialog "Test", \
           "MS Sans Serif",10, \
           WS_OVERLAPPED or WS_SYSMENU or DS_CENTER, \
           4,0,0,160,120,1024

    DlgList WS_BORDER or WS_VSCROLL, \
            7,7,68,79,IDC_LST1

    DlgList WS_BORDER or WS_VSCROLL or LBS_DISABLENOSCROLL, \
            82,7,68,79,IDC_LST2

    DlgButton "Add",0,72,89,35,12,IDC_BTN1

    DlgButton "Remove",0,115,89,35,12,IDC_BTN2

    invoke GetModuleHandle, NULL
    CallModalDialog eax,0,DlgProc,NULL

    exit
;==============================================================================
end start
eschew obfuscation

Farabi

Here is how i Create the listbos


mov   edx, WS_VSCROLL or WS_HSCROLL or WS_VISIBLE or \
              WS_BORDER or WS_CHILD or \
              LBS_HASSTRINGS or LBS_NOINTEGRALHEIGHT or \
              LBS_DISABLENOSCROLL
    invoke CreateWindowEx,WS_EX_CLIENTEDGE,CADD("ListBox"),NULL,edx,300,80,280,150,hWnd,3,hInstance,NULL
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

Farabi

Sorry I mean horizontal, vertical work for me.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

Gunner

That is an easy one.. set the listbox sytle LBS_MULTICOLUMN  :bg

if you want you can set the "colum" width to something bigger than your listbox to show the scrollbar
LB_SETCOLUMNWIDTH

but just setting  LBS_MULTICOLUMN should work fine...  :8)
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

Farabi

Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"