Scrolling in a Browse window

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Posts: 3185
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 211 times
Been thanked: 112 times

Re: Scrolling in a Browse window

Post by mol » Tue Apr 16, 2013 6:20 am

CalScot wrote:

Code: Select all

Set SoftSeek On
DBSeek ( NowDtHr )
Set SoftSeek Off
By the way, you can reduce this phrase using

Code: Select all

DBSeek ( NowDtHr, .T. )
second parameter of DBSeek specifies whether a soft seek is to be performed.


User avatar
Posts: 272
Joined: Thu Mar 21, 2013 12:22 am
Location: California
Been thanked: 1 time

Post by CalScot » Tue Apr 16, 2013 7:00 am

Thanks, Marek.

That's another new one for me - I like it, and I do prefer to write compact code if I can!
(I need to move forward from what I was familiar with from Summer '87!)

Thanks, too, for the Debug setup info. I've played around with it a lot, and although it's taken a bit of getting used to in trying to make it do what I want, I'm learning it's quirks, and I suspect that I'll end up using it often!!

Thanks again.

User avatar
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines
Been thanked: 2 times

Post by dhaine_adp » Tue Apr 16, 2013 7:02 pm

Hi CalScot,

I'm glad that you fixed your browse problem.

Attached in here is a browse Test function that includes the following:

1. brwTest.prg - the main browse demo.

2. winAutoAj.prg - Auto adjust module that adjust the windows control on the form. It has been modified to prevent auto adjustment of the font size, slider control and status bar. (I have adopted the code from one of the threads of this forum)

3. daterange.prg - popup date range selection. A generic routine. For more details read the source code comment. I use to write my function libraries that way so that my children can reuse my code.

4. build.bat - compile and link batch file. You may need to adjust the path definition to point in your HMG installation folder.

On the first time run, it will create two files:
1. sample.dbf
2. sampledate.ntx
Then it goes on in populating the table with garbage test data set. It may take a while because of the INKEY() calls. I used it to add some delay so that my less precission random number generator generates different number.

It can be compiled with HMG 3.0.46, HMG 3.1.2, I believed it will also work with 3.1.1 The resource file used are standard HMG resource file included in the executable file during compilation and linking process.

To Search the test data using the Quick Find Bar (Quick find Textbox) you have to enter the date using the format "YYYYMMDD" without the date separators. Click the text box and type the date value that you are looking for. To clear it press enter key once.

Feel free to use the codes if you find them useful.


(6.71 KiB) Downloaded 166 times

Manila, Philippines

User avatar
Posts: 272
Joined: Thu Mar 21, 2013 12:22 am
Location: California
Been thanked: 1 time

Post by CalScot » Tue Apr 16, 2013 10:16 pm

Thanks, Danny.

I'll take a look at your test/sample files tonight or tomorrow.

In the meantime, I discovered that although the code I posted before did work for the opening screen, the "Found()" record didn't always show at the top row of the browse in other bits of code where I had to assign the value right before a refresh.

Also, it only works properly for the opening screen when the browse's definition value set to 0. Anything else (1+) and the pointer goes to the assigned record rather than to the "Go [To]" record! So there is absolutely nothing before GoToNow() that assigns a value to the browse -- only a few .T. or .F. assignments, some "Set XXX On/Off" statements and then a call to a function that opens tables, builds index files, and sets relations. (The final table opened and indexed is the browse's workarea.)

However, I found a way that allows the opening screen to work (as previously shown, not using the code below), but which also works in all the other places/cases I've tested:

Code: Select all

DbSeek ( SrchDate, .T. )
If Eof()
   Go Top
nRec := RecNo()
UCMain.Browse_1.Value := RecCount()+1
Go nRec
That, too, doesn't seem to make a lot of sense, but... It seems that the rule is:

IF the browse value is set to 0 (i.e., to not display!), either in the window control definition or by assigning "<Window>.<Browse>.Value := RecCount()+1", THEN a subsequent Go [To] command followed by Refresh and SetFocus DOES display the browse, with the Found() record on the top row.

If that's not the rule, then I'm sure that someone will let me know, but I'm pretty sure of it now. Above all, I'm just happy that it all seems to be working!

Thanks again.

Post Reply