Page 1 of 1
ListBox in DLL file
Posted: Mon Sep 18, 2006 12:39 am
by tsai8839
Dear all,
In my DLL file, I put a listbox and selected both Vertical and Horizontal scroll bar. The source code is:
REDEFINE LISTBOX oLbx FIELDS ID 110 OF oDlg
When I run the application, there is no horizontal scroll bar in the listbox, there is vertical scroll bar only. If I use this code:
@ 1, 1 LISTBOX oLbx FIELDS SIZE 280, 140 OF oDlg without using DLL file, then it works fine.
Does anyone can solve this problem?
Posted: Mon Sep 18, 2006 4:29 am
by dutch
Dear Andy,
Put following line before DEFINE LISTBOX
TWBrowse():lHScroll:= .T.
Regards,
Dutch
Posted: Mon Sep 18, 2006 6:14 am
by tsai8839
Dear Dutch,
Thanks a lot for your help.
Posted: Mon Sep 18, 2006 12:26 pm
by Enrico Maria Giordano
dutch wrote:Dear Andy,
Put following line before DEFINE LISTBOX
TWBrowse():lHScroll:= .T.
Regards,
Dutch
As far as I know, there is no lHScroll instance variable in TWBrowse class.
EMG
Posted: Mon Sep 18, 2006 12:52 pm
by tsai8839
Dear Enrico,
Thank you for your information, I try to put TWBrowse():lHScroll:= .T. before DEFINE LISBOX, then, I got an Error description: Error Objects/6 No Exp. Method: TWBROWSE:_LHSCROLL.
Do you have any suggestion?
Posted: Mon Sep 18, 2006 12:55 pm
by Enrico Maria Giordano
You should try to put it after REDEFINE LISTBOX FIELDS command.
It should not work anyway.
EMG
Posted: Mon Sep 18, 2006 1:09 pm
by tsai8839
Dear Enrico,
Now I try to put it after REDEFINE LISTBOX FIELDS command and It has occurs the same error description. Do you have better way to fix it?
Posted: Mon Sep 18, 2006 1:35 pm
by James Bott
Andy,
This is from my notes:
To turn off the scrollbars do:
// Turn off the horizontal
oLbx:oHScroll:setRange( 0, 0 )
oLbx:oHScroll:= Nil
// Turn off the vertical
oLbx:oVScroll:setRange( 0, 0 )
oLbx:oVScroll:= Nil
Setting oLbx:nStyle does not seem to have any effect.
For horizontal scrolling you will also need to freeze all the columns due to a bug. When you turn off horizontal scrolling then click on the last column it still scrolls one column to the right. Freezing all the columns fixes this.
oLbx:nFreeze:= 5 // or whatever no. of columns you have.
There something else to consider. The listbox in Workshop is NOT the same listbox we use as a browse. We use the term "listbox" as the command in our code, but the preprocessor changes it to call our TWBrowse class. Note that you can actually define a "listbox" in Workshop and it will work kind-of in your code, but it will have problems.
So the solution is that you have to add a custom control named "TWBrowse" to Workshop, then redefine that in your code instead of using the "listbox" in Workshop.
James
Posted: Mon Sep 18, 2006 4:37 pm
by dutch
Dear All,
Sorry, this Twbrowse():lHScroll instance is from TWbrowse classes of Hernan Ceccarelli.
Best Regards,
Dutch
Posted: Tue Sep 19, 2006 12:40 pm
by tsai8839
Dear James,
Thank you very much for your help. It works fine now.
I also would like to thank all who gave me a hand.