News:

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

Main Menu

ScrollBar doesnt show in RichEdit Control.

Started by xandaz, November 06, 2020, 03:11:26 AM

Previous topic - Next topic

xandaz

    Hy guys. I created both horizontal and vertical scrollbars for a RichEdit controls but they don't show. Anyone knows why?

TouEnMasm


There must be enought text in the richedit for that.
But without the code ,it isn't possible to affirm it is that.
Fa is a musical note to play with CL

xandaz

     There's enough text. the bars just dont show.
        invoke  CreateWindowEx,0,addr WC_SCROLLBAR,0,WS_VISIBLE+WS_CHILD+SBS_VERT+SBS_RIGHTALIGN,\
                    CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,\
                    [edi.MdiStruct.hEdit],0,hInstance,0
        mov     [edi.MdiStruct.hVScroll],eax
        invoke  SendMessage,eax,SBM_SETRANGE,0,1000                   
        invoke  CreateWindowEx,0,addr WC_SCROLLBAR,0,WS_VISIBLE+WS_CHILD+SBS_HORZ+SBS_BOTTOMALIGN,\
                    CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,\
                    [edi.MdiStruct.hEdit],0,hInstance,0
        mov     [edi.MdiStruct.hHScroll],eax
        invoke  SendMessage,eax,SBM_SETRANGE,0,1000
        invoke  EnableScrollBar,[edi.MdiStruct.hEdit],SB_BOTH,ESB_ENABLE_BOTH



xandaz

   oh i see now. they need size. i thought there was a way to automate the scrollbars. problem solved

xandaz

     This complicates the hell outta my job. if i use SBS_HORZ and SBS_VERT don't the scroll bars just appear sized and aligned as witth SBS_BOTTOMALGIN and SBS_LEFTALIGN?

TouEnMasm


Try this

Quote
   INVOKE     CreateWindowEx, NULL, addr crichedit, NULL,\
      WS_CHILD or WS_BORDER or ES_MULTILINE or \
      ES_NOHIDESEL or ES_SAVESEL or ES_SELECTIONBAR or\
      WS_HSCROLL or ES_AUTOHSCROLL or\
      WS_VSCROLL or ES_AUTOVSCROLL or WS_CLIPSIBLINGS or WS_CLIPCHILDREN,\
      0, 0,largeur, hauteur, Htab,NULL, Hinst, NULL
Fa is a musical note to play with CL

Greenhorn

Hi xandaz,

why don't you just use ES_AUTOHSCROLL | ES_AUTOVSCROLL in the style flags of the RichEdit ?

Setting up your own scroll bars needs management about line height/width and window height/width.
https://docs.microsoft.com/en-us/windows/win32/controls/scroll-text-in-scroll-bars

But I'm not sure if you receive the WM_HSCROLL/WM_VSCROLL messages if the mouse is ovr the rich edit control.

Kind regards
Greenhorn
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

Greenhorn

Quote from: TouEnMasm on November 06, 2020, 04:47:04 AM

Try this

Quote
   INVOKE     CreateWindowEx, NULL, addr crichedit, NULL,\
      WS_CHILD or WS_BORDER or ES_MULTILINE or \
      ES_NOHIDESEL or ES_SAVESEL or ES_SELECTIONBAR or\
      WS_HSCROLL or ES_AUTOHSCROLL or\
      WS_VSCROLL or ES_AUTOVSCROLL or WS_CLIPSIBLINGS or WS_CLIPCHILDREN,\
      0, 0,largeur, hauteur, Htab,NULL, Hinst, NULL

Thanks ToutEnMasm  :thumbsup:
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

xandaz

    Thanks a lot. I knew there was a way. thanks tout  :thumbsup: