ListBox in DLL file

Post Reply
tsai8839
Posts: 22
Joined: Mon Jul 24, 2006 6:45 am

ListBox in DLL file

Post 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?
Regards,

Andy Tsai
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Dear Andy,

Put following line before DEFINE LISTBOX
TWBrowse():lHScroll:= .T.

Regards,
Dutch
tsai8839
Posts: 22
Joined: Mon Jul 24, 2006 6:45 am

Post by tsai8839 »

Dear Dutch,

Thanks a lot for your help.
Regards,

Andy Tsai
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
tsai8839
Posts: 22
Joined: Mon Jul 24, 2006 6:45 am

Post 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?
Last edited by tsai8839 on Mon Sep 18, 2006 12:57 pm, edited 1 time in total.
Regards,

Andy Tsai
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

You should try to put it after REDEFINE LISTBOX FIELDS command.

It should not work anyway.

EMG
tsai8839
Posts: 22
Joined: Mon Jul 24, 2006 6:45 am

Post 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?
Regards,

Andy Tsai
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Dear All,

Sorry, this Twbrowse():lHScroll instance is from TWbrowse classes of Hernan Ceccarelli.

Best Regards,
Dutch
tsai8839
Posts: 22
Joined: Mon Jul 24, 2006 6:45 am

Post 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.
Regards,

Andy Tsai
Post Reply