Page 1 of 2

Multiple Browses???

Posted: Tue Aug 28, 2007 2:03 pm
by Greg Gammon
Greetings again....I have stumbled on a problem I can't seem to overcome (AGAIN)....

I am attempting to put together a scheduling matrix where I have four browses based on date criteria. The reason I have separate browses is because I need seperate headings above each of them showing the date and a total calculation for two columns in the browse...and each heading has a different color.

Each of the four browses uses the same database with a different select based on the date. All I get is VERY erratic results. I guess my first question should be...is this even a possiblity to get working??

Sample of my code:

Select Database
Index on field->date to temp

Redefine SAY ... (title and calculations) COLORS ....
Redefine Listbox
Fields...
Headings....
SELECT field->date FOR dDate1
ON DBLCLICK changedate()

each other listbox has....
SELECT field->date FOR dDate2....dDate3....etc.

Beyond the selects not working properly, when I implement a date change on one record...it seems to change the date on ALL the records in ALL the browses....and then the browses themselves go haywire with data extending out of the confines of the box (even using upstable(), refresh() etc.).

Just wondering if Im attemping to do something that will no way work!

Thanks in advance.
Greg

Posted: Tue Aug 28, 2007 2:16 pm
by PeterHarmes
The way i've done it in the past is to open the database in more than one area with a diferent alias.
You can then create an index/filter/scope on one alias that doesnt effect the others.

Hope that helps

Pete

Posted: Tue Aug 28, 2007 2:27 pm
by Greg Gammon
Excellent! I would not have thought of that...appreciate the help there....
G

Posted: Tue Aug 28, 2007 2:52 pm
by James Bott
>The way i've done it in the past is to open the database in more than one area with a diferent alias.

With my database class, TData, all that is handled automatically.

oSchedule1:= TData():new(,"schedule")
oSchedule2:= TData():new(,"schedule")
oSchedule3:= TData():new(,"schedule")
oSchedule4:= TData():new(,"schedule")

Then browse each oSchedule object. No dealing with aliases. Easy!

More about TData is here.

http://ourworld.compuserve.com/homepage ... rogram.htm

James

Posted: Wed Aug 29, 2007 1:14 am
by Greg Gammon
James,
Thanks for the info there. I have to admit, as a "weekend programmer", alot of the concepts of METHODS are beyond me right now...came from the old Procedural coding school....object oriented im just now beginning to grasp...laugh...but I am learning alot! I'll keep your Tbrowse in mind as I start progressing.

I did the multiple area coding...was simple enough and works fine for what I am implementing. One last thing I need to figure out now though is how to keep the current record in each of the browses from being highlighted unless the focus is on that particular browse....how do I code that?

I am using color text and highlights based on data (nclrpane, nclrtext) and having that highlighted line throws the whole scheme off.

Thanks again!
Greg

Posted: Wed Aug 29, 2007 1:40 am
by Greg Gammon
One more question while Im at it....
In these particular browses which have filters...when there should be NO data in a browse, there is still a blank data line (with empty date fields ... " / / " and "0" in numeric fields....how can I blank this out? Just another annoyance....laugh

Posted: Wed Aug 29, 2007 8:42 am
by PeterHarmes
Greg Gammon wrote:One more question while Im at it....
In these particular browses which have filters...when there should be NO data in a browse, there is still a blank data line (with empty date fields ... " / / " and "0" in numeric fields....how can I blank this out? Just another annoyance....laugh
you need to use the folowing:

oBrw:bLogicLen := {|| number of records in the list }

after you have set your scope/filters etc add the above line and insert the number of records in the filter/scope. Be carefull if you can have a lot of records in the dbf.

Hope that helps

Pete

Posted: Wed Aug 29, 2007 2:19 pm
by James Bott
Greg,

>Thanks for the info there. I have to admit, as a "weekend programmer", alot of the concepts of METHODS are beyond me right now...came from the old Procedural coding school....object oriented im just now beginning to grasp...laugh...but I am learning alot!

There are a couple of articles I wrote about programming with OOP on my site also. You will find that it is MUCH simpler than procedural coding, once you get to the "Ah, Ha!" point.

>I'll keep your Tbrowse in mind as I start progressing.

Hmm, there is a TSBrowse on my site, but I was referring in my earlier message to TData, my database class. See this page:

http://ourworld.compuserve.com/homepage ... /tdata.htm

James

Posted: Wed Aug 29, 2007 2:34 pm
by Greg Gammon
James,
My bad...i meant TData...right. I do get the beauty of object oriented...sometimes just struggle learning new coding techniques....my code is a mish mash of old style and new style now...heaven forbid anyone would have to come behind me and revise code...slowly but surely it all comes together. Not knowing any C language though leaves me a bit mystified sometimes at how many methods are implemented...but its a learning process! Thanks to guys like you who help us all out!!!

Still need to figure out how to keep the current record pointer in a browse from highlighting....any tips?

Thanks,
G

Posted: Wed Aug 29, 2007 3:14 pm
by James Bott
Greg,

>Still need to figure out how to keep the current record pointer in a browse from highlighting....any tips?

First let me say that doing this is not standard behavior so I would advise against it. I'm not saying one should never deviate from the standard but you should have a really good reason for doing so. Users expect programs to all work similarly.

If you still want to do this, then use oLbx:bLostFocus to change the color of the highlight and then redraw the line (oLbx:drawSelect()). Then use oLbx:bGotFocus to reset it.

Code: Select all

oLbx:bLostFocus:={||   oLbx:nClrForeFocus:= rbg(..., ...),   oLbx:nClrBackFocus:= rgb(..., ...), oLbx:drawSelect() }
In the past there was a bug and one or both of these methods called each other so this technique was not possible. I am not sure if it has been fixed, but you can give it a try.

James

Posted: Tue Sep 04, 2007 9:27 pm
by Greg Gammon
James,
I tested this method out (bLostFocus....) and I can make this work when the Browse itself has focus...I have four browses in the Dialog, and when the focus goes to the next browse, then the current record pointer in the previous browse highlights again (in gray meaning it is current but not active...as opposed to blue as current and active). I think what I actually am looking for is how to eliminate the highlight when there is no focus on the browse itself. Any ideas on that?

Thanks,
G

Posted: Tue Sep 04, 2007 9:48 pm
by James Bott
Greg,

>I tested this method out (bLostFocus....) and I can make this work when the Browse itself has focus...I have four browses in the Dialog, and when the focus goes to the next browse, then the current record pointer in the previous browse highlights again (in gray meaning it is current but not active...as opposed to blue as current and active).

My mistake on the colors, those are the normal colors for the selected line, not the out-of-focus colors. Turning gray is standard windows behavior and as I said, it is what users expect.

>I think what I actually am looking for is how to eliminate the highlight when there is no focus on the browse itself. Any ideas on that?

If you still want to do this, it looks like you are going to have to modify the TWBrowse source code. Look at the DrawSelect() method.

James

Posted: Wed Sep 05, 2007 12:52 am
by Greg Gammon
James,

I have never delved into modifying the source code for any of the classes. In doing so, do I need to do any other steps before compiling my program? Does the source code itself have to be compiled? Ive never gotten that deep into how the compiling process actually works....
G

Posted: Wed Sep 05, 2007 12:53 am
by Greg Gammon
James,

I have never delved into modifying the source code for any of the classes. In doing so, do I need to do any other steps before compiling my program? Does the source code itself have to be compiled? Ive never gotten that deep into how the compiling process actually works....
G

Posted: Wed Sep 05, 2007 1:15 am
by James Bott
Greg,

>I have never delved into modifying the source code for any of the classes. In doing so, do I need to do any other steps before compiling my program? Does the source code itself have to be compiled? Ive never gotten that deep into how the compiling process actually works....

Modifing source is another thing I don't recommend. But if you wish to, just copy it to your program's directory, modify it and compile it like any other PRG in your program. Link it the same too.

The downside is that you will have to modify the same PRG in the FW source each time you get a new version of FW. And you risk there being bugs due to other changes in that source or other FW source PRGs so you need to test it well too.

James