Listbox Multiline and no scrool bar
Moderator: Rathinagiri
Listbox Multiline and no scrool bar
Hello,
I've got frustrated while trying to get multiline on listbox and disable the scrollbar.. There's a way for that?
Thanks
I've got frustrated while trying to get multiline on listbox and disable the scrollbar.. There's a way for that?
Thanks
AMD Phenom II X6 1090T 3.2GHz (OverClock 3.9GHz) | Windows 8.1 Pro 64-bit
4GB DDR3 | GTX 550 Ti 1GB | MSI 880GMA-E35
4GB DDR3 | GTX 550 Ti 1GB | MSI 880GMA-E35
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Listbox Multiline and no scrool bar
Seems is not any workable function to disable in ListBox. What I found is to make your own C function which is used for initializate a ListBox like this:
viewtopic.php?p=8442#p8442
and correction (taking off WS_VSCROLL) in this:
viewtopic.php?p=8451#p8451
viewtopic.php?p=8442#p8442
and correction (taking off WS_VSCROLL) in this:
viewtopic.php?p=8451#p8451
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Listbox Multiline and no scrool bar
I found this workable function: HMG_ChangeWindowStyle and I prepare this Demo:
This HMG_ChangeWindowStyle function is basically for window/forms, but in this Demo the DISABLE option is working
P.S. Code has been re-edited and corrected
Code: Select all
#include "hmg.ch"
Function Main
DEFINE WINDOW Win1 ;
AT 0,0 ;
WIDTH 360 ;
HEIGHT 180 ;
TITLE 'Scroll Bar in ListBox' ;
MAIN
DEFINE LISTBOX LIST1
ROW 10
COL 10
WIDTH 100
HEIGHT 110
ITEMS { '01','02','03','04','05','06','07','08','09','10' }
END LISTBOX
DEFINE BUTTON BUTTON1
ROW 10
COL 150
CAPTION 'Disable Vertical Scroll Bar'
ACTION Scroll_OFF()
WIDTH 150
END BUTTON
DEFINE BUTTON BUTTON2
ROW 40
COL 150
CAPTION 'Enable Vertical Scroll Bar'
ACTION Scroll_ON()
WIDTH 150
END BUTTON
END WINDOW
CENTER WINDOW Win1
ACTIVATE WINDOW Win1
Return Nil
Function Scroll_OFF()
Local hWnd := GetControlHandle ("LIST1","Win1")
HMG_ChangeWindowStyle ( hWnd, NIL, WS_VSCROLL, .F. )
Return Nil
Function Scroll_ON()
Local hWnd := GetControlHandle ("LIST1","Win1")
// HMG_ChangeWindowStyle ( hWnd, NIL, WS_VSCROLL, .T. ) // wrong
HMG_ChangeWindowStyle ( hWnd, WS_VSCROLL, NIL, .F. )
Return Nil
P.S. Code has been re-edited and corrected
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Listbox Multiline and no scrool bar
I do not know why enable option doesn't works !
- Attachments
-
- Screen.PNG (21.42 KiB) Viewed 5319 times
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: Listbox Multiline and no scrool bar
to enable option Use code : HMG_ChangeWindowStyle ( hWnd, WS_VSCROLL, NIL, .F. )Pablo César wrote:I do not know why enable option doesn't works !
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: Listbox Multiline and no scrool bar
Thank you Dave, you are right !bpd2000 wrote:to enable option Use code : HMG_ChangeWindowStyle ( hWnd, WS_VSCROLL, NIL, .F. )Pablo César wrote:I do not know why enable option doesn't works !
I made a mistake to put in wrong way as HMG_ChangeWindowStyle ( hWnd, NIL, WS_VSCROLL, .T. )
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: Listbox Multiline and no scrool bar
Oh, thanks,
It Works very well, but i mainly need a listbox with multiline (I mean 2 or more lines in a single item) like a text with CRLF between each line
It Works very well, but i mainly need a listbox with multiline (I mean 2 or more lines in a single item) like a text with CRLF between each line
AMD Phenom II X6 1090T 3.2GHz (OverClock 3.9GHz) | Windows 8.1 Pro 64-bit
4GB DDR3 | GTX 550 Ti 1GB | MSI 880GMA-E35
4GB DDR3 | GTX 550 Ti 1GB | MSI 880GMA-E35
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: Listbox Multiline and no scrool bar
You mean 2 columns, right ?meneale wrote:Oh, thanks,
It Works very well, but i mainly need a listbox with multiline (I mean 2 or more lines in a single item) like a text with CRLF between each line
If is the case, try to concatenate each item and use Courier New (monospaced font).
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: Listbox Multiline and no scrool bar
Então Pablo, não queria duas colunas e sim duas linhas em um único item, como isto:
Já tentei usando CHR(13) + CHR(10) entre cada linha mas quando compilado o programa exclui o CRLF.
Já tentei usando CHR(13) + CHR(10) entre cada linha mas quando compilado o programa exclui o CRLF.
AMD Phenom II X6 1090T 3.2GHz (OverClock 3.9GHz) | Windows 8.1 Pro 64-bit
4GB DDR3 | GTX 550 Ti 1GB | MSI 880GMA-E35
4GB DDR3 | GTX 550 Ti 1GB | MSI 880GMA-E35
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Listbox Multiline and no scrool bar
Ahh sim entendi. Não tem esta opção o nosso ListBox ao menos que seja modificado a função C INITLISTBOX e pelo que pesquisei o ListBox Style precisaria de LBS_OWNERDRAWVARIABLE
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein