Page 2 of 3

Re: Scrollbars missing

Posted: Wed Feb 19, 2014 4:26 pm
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

Re: Scrollbars missing

Posted: Wed Feb 19, 2014 4:53 pm
by Greg Gammon
Will do...I appreciate the advice.
G

Re: Scrollbars missing

Posted: Wed Feb 19, 2014 6:47 pm
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

Re: Scrollbars missing

Posted: Wed Feb 19, 2014 7:06 pm
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

Re: Scrollbars missing

Posted: Wed Feb 19, 2014 7:13 pm
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

Re: Scrollbars missing

Posted: Wed Feb 19, 2014 7:29 pm
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

Re: Scrollbars missing

Posted: Wed Feb 19, 2014 10:53 pm
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

Re: Scrollbars missing

Posted: Wed Feb 19, 2014 11:40 pm
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

Re: Scrollbars missing

Posted: Thu Feb 20, 2014 12:33 am
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

Re: Scrollbars missing

Posted: Thu Feb 20, 2014 1:59 am
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

Re: Scrollbars missing

Posted: Thu Feb 20, 2014 8:07 am
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

Re: Scrollbars missing

Posted: Thu Feb 20, 2014 2:43 pm
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

Re: Scrollbars missing

Posted: Thu Feb 20, 2014 4:29 pm
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

Re: Scrollbars missing

Posted: Thu Feb 20, 2014 4:41 pm
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

Re: Scrollbars missing

Posted: Thu Feb 20, 2014 4:55 pm
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