Scrollbars missing

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

Re: Scrollbars missing

Post by James Bott »

Greg,

I am not clear what you are saying.

If you use LISTBOX...FIELDS, then it will pre-process to TXBrowse. Anything defined this way is not going to have a scrollbar unless you change the RC file by adding the LBS_DISABLENOSCROLL.

TCBrowse is a separate browse. I haven't used it in a very long time, but I don't think it is syntax compatible with TXBrowse. Are you saying that your TCBrowses don't have scrollbars either?

It is my suggestion for these types of problems, to create the simplest possible example that shows the problem then try to solve it with that example instead of a full-blown app. A simple test example also allows others to help with your problem.

If you want to get started with TXBrowse, then I would look at some of the examples in the fwh\samples directory.

Regards,
James
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Re: Scrollbars missing

Post by Greg Gammon »

Will do...I appreciate the advice.
G
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Scrollbars missing

Post by Enrico Maria Giordano »

Greg,
Greg Gammon wrote:I guess I just need to switch over to the xbrowse class.
Please keep in mind that with XBrowse you'll have to use

Code: Select all

CONTROL "", 1003, "TXBrowse", WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 15, 49, 335, 145
or something similar. The root of the problem is that you are using the wrong resource (LISTBOX, a standard Windows control) for a custom control. The best you can do for the future of your work is fix your resources now.

EMG
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Re: Scrollbars missing

Post by Greg Gammon »

Im sure I will have to be more imaginative in how to deal with editing the resources.
As I am continually updating the application using the RESEDIT GUI to build or change dialogs, when RESEDIT creates the .rc file, I would have to go in manually each time to change all of the LISTBOX structures as you are showing me. This wouldn't be a real issue if my application was particularly static, but we are continually making updates and improvements. Anyone have any advice on an "easy" way to handle this?

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

Re: Scrollbars missing

Post by Enrico Maria Giordano »

Greg,
Greg Gammon wrote:Im sure I will have to be more imaginative in how to deal with editing the resources.
As I am continually updating the application using the RESEDIT GUI to build or change dialogs, when RESEDIT creates the .rc file, I would have to go in manually each time to change all of the LISTBOX structures as you are showing me. This wouldn't be a real issue if my application was particularly static, but we are continually making updates and improvements. Anyone have any advice on an "easy" way to handle this?

Thanks!
Greg
You have to use "custom control" not listbox.

EMG
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Re: Scrollbars missing

Post by Greg Gammon »

Yes I have looked at that but haven't delved into it very deeply. Not sure how to save custom control parameters in ResEdit. I'll look into that. If anyone uses ResEdit and can help, much appreciated!
G
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Scrollbars missing

Post by James Bott »

Greg,

Here is a simple example of how you use TXbrowse instead of Listbox.

Create a custom control called "TXBrowse" and edit the style to something like:

Code: Select all

0 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL
There is no REDEFINE XBROWSE syntax, so we have to use this:

Code: Select all

oBrw := TXBrowse():new( oDlg ):CreateFromResource( 11 )
Where "11" is the control ID number.

Here is the entire sample code showing both Listbox and TXBrowse:

Code: Select all

#include "fivewin.ch"

Function Main()

   LOCAL oDlg, oLbx

   USE customer

   DEFINE DIALOG oDlg resource "DIALOG1"

   REDEFINE LISTBOX oLbx fields FIRST, LAST ID 10 OF oDlg

   oBrw := TXBrowse():new( oDlg ):CreateFromResource( 11 )

   ACTIVATE DIALOG oDlg

return nil
And here is the RC file:

Code: Select all

/****************************************************************************


test01.rc

produced by Borland Resource Workshop


*****************************************************************************/

#define DIALOG_1    1
#define IDC_LISTBOX1    10
#define IDC_1   11

DIALOG1 DIALOG 6, 15, 275, 201
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "DIALOG1"
FONT 8, "MS Sans Serif"
{
 LISTBOX IDC_LISTBOX1, 20, 15, 235, 75, LBS_STANDARD | LBS_DISABLENOSCROLL
 CONTROL "", IDC_1, "TXBrowse", 0 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL, 25, 104, 229, 71
}
James
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Scrollbars missing

Post by Enrico Maria Giordano »

James,
James Bott wrote:

Code: Select all

0 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL
This is enough:

Code: Select all

WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL
EMG
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Scrollbars missing

Post by James Bott »

Greg,

A simple solution is to just load your RC file into a TEXT editor and change the LISTBOX definitions to custom TWBrowse controls as Enrico showed. In this example I have just commented out the LISTBOX line and added the CONTROL line. This will fix the scrollbar.

Code: Select all

 /*LISTBOX IDC_LISTBOX1, 20, 15, 235, 75, LBS_STANDARD*/
 CONTROL "", IDC_LISTBOX1, "TWBrowse", 0 | WS_CHILD | WS_VISIBLE | WS_VSCROLL, 20, 15, 235, 75
 
Backup your RC file, then just edit one browse as shown and save the RC file and compile. The scrollbar should be visible. I tried it here and it worked fine.

If you look at the preprocessor output the two outputs are identical. So the control name in the resource file seems to be what triggers the scrollbar. I know not why.

Let us know.

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

Re: Scrollbars missing

Post by James Bott »

Enrico,

Thanks, I didn't know the zero wasn't needed.

Greg,

You can also leave off the WS_BORDER to get the more current flat look as I did in my previous example. So now you would have:

Code: Select all

 CONTROL "", IDC_LISTBOX1, "TWBrowse", WS_CHILD | WS_VISIBLE | WS_VSCROLL, 20, 15, 235, 75
 
James
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Scrollbars missing

Post by Enrico Maria Giordano »

James,
James Bott wrote:Thanks, I didn't know the zero wasn't needed.
The symbol | (pipe) indicates OR so 0 OR something = something (0 is false). :-)

EMG
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Re: Scrollbars missing

Post by Greg Gammon »

Thanks for all the good info! I will try this in the next few days. I guess it will just boil down to some extra work to manage the .rc file when I make screen changes....sigh.
G
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Scrollbars missing

Post by James Bott »

Greg,
I guess it will just boil down to some extra work to manage the .rc file when I make screen changes....sigh.
There will be no extra work when you make changes. When the RC file is loaded back into the resource editor, it will show up as a custom control. I presume the only changes you might be making are the size and location. When saved it should be the same code as you entered using the text editor with the only difference being the coordinates.

You could convert to custom controls using the resource editor, but it will be much more work than using a text editor. With a text editor you can just enter the new control line with the original to refer to. With a resource editor you would have to delete the original control, then create the custom control, redraw it, and then edit the style. No contest.

James
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Re: Scrollbars missing

Post by Greg Gammon »

ResEdit will not load a native .rc file...it uses .res binary file and then creates an .rc file. I guess I need to switch to a different resource editor that will use native .rc file. Borland? I recall using Borland years ago and switched because of some problems I had with it...institutional memory is lapsing here.
Thanks,
Greg
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Scrollbars missing

Post by James Bott »

Greg,

Hmm, well I suggest creating the RC with ResEdit then edit it with a text editor (just one listbox-to-TWBrowse conversion), then using Borland's Workshop, load it and save it, then compile and test. If there are no problems then it would seem you are good to go with Workshop.

Or, you could just generate the RES with workshop after you are done with the text editor, and then use the RES file with ResEdit as usual.

Of course, make backups of everything first.

James
Post Reply