Hey Ted,
Thanks for "Getting That For me".
So - yes, I decided to go the Grid route on this issue. I did look at the 1001/Ch 6 - but, in the webpage it refers to using sample code that came with the book.
However, I saw one of the links above it - from Foxite. I decided to implement that code. To be honest - I hadn't sub-classed before, but, I figured it out and made a Grid sub-class.
However, I'm having a problem in implementing the code. I implemented everything as stated on this webpage: https://www.foxite.com/faq/default.aspx?id=3#
I believe I implemented all the code correctly. However, I'm having a problem with the following lines: WITH THIS .nActiveRow = IIF(.ACTIVEROW = 0, .nActiveRow ,.ACTIVEROW) && Assign value to class property
Originally the 2nd line above was as follows: .nActiveRow =.ACTIVEROW && Assign value to class property
The problem is - value in ACTIVEROW is Always Zero (a property in the Grid ). I have NO Idea why its always Zero. In theory - if I change to another record - it should be giving the record #.
Any suggestions would be greatly appreciated.
Regards, Kurt
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Thursday, January 28, 2016 4:50 PM To: profoxtech@leafe.com Subject: Re: A Question of ListBoxes...
On Thu, Jan 28, 2016 at 4:04 PM, Kurt Wendt Kurt_Wendt@globetax.com wrote:
To a certain extent - I agree. If they want a Grid - maybe I should give them one. That being said - I don't think there is a straightforward way in a Grid to Select Multiple items. Am I wrong? Although - After writing the last 2 sentences - some ideas were rolling around in my head about implementing a multi-select in a Grid. Since, at least with me - I know anything is possible - as I've done some interesting screen designs in the past!
Forgive me, but the answer is obviously: http://bfy.tw/3yWI
and again, I recommend 1001, Chapter 6 this time.
-- Ted Roche & Associates, LLC http://www.tedroche.com
[excessive quoting removed by server]
OK - strangely enough - when I was trying to review the issues and stepping thru the Method where the main processing takes place - that ActiveRow kept showing as Zero. But, now, in that Method - I simply put in a Wait statement and have it report what the ActiveRow - and now its showing a proper record # value. Very strange...
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Friday, January 29, 2016 5:20 PM To: profoxtech@leafe.com Subject: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Hey Ted,
Thanks for "Getting That For me".
So - yes, I decided to go the Grid route on this issue. I did look at the 1001/Ch 6 - but, in the webpage it refers to using sample code that came with the book.
However, I saw one of the links above it - from Foxite. I decided to implement that code. To be honest - I hadn't sub-classed before, but, I figured it out and made a Grid sub-class.
However, I'm having a problem in implementing the code. I implemented everything as stated on this webpage: https://www.foxite.com/faq/default.aspx?id=3#
I believe I implemented all the code correctly. However, I'm having a problem with the following lines: WITH THIS .nActiveRow = IIF(.ACTIVEROW = 0, .nActiveRow ,.ACTIVEROW) && Assign value to class property
Originally the 2nd line above was as follows: .nActiveRow =.ACTIVEROW && Assign value to class property
The problem is - value in ACTIVEROW is Always Zero (a property in the Grid ). I have NO Idea why its always Zero. In theory - if I change to another record - it should be giving the record #.
Any suggestions would be greatly appreciated.
Regards, Kurt
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Thursday, January 28, 2016 4:50 PM To: profoxtech@leafe.com Subject: Re: A Question of ListBoxes...
On Thu, Jan 28, 2016 at 4:04 PM, Kurt Wendt Kurt_Wendt@globetax.com wrote:
To a certain extent - I agree. If they want a Grid - maybe I should give them one. That being said - I don't think there is a straightforward way in a Grid to Select Multiple items. Am I wrong? Although - After writing the last 2 sentences - some ideas were rolling around in my head about implementing a multi-select in a Grid. Since, at least with me - I know anything is possible - as I've done some interesting screen designs in the past!
Forgive me, but the answer is obviously: http://bfy.tw/3yWI
and again, I recommend 1001, Chapter 6 this time.
-- Ted Roche & Associates, LLC http://www.tedroche.com
[excessive quoting removed by server]
Might be to do with focus.
From Help:
The ActiveRow property does not return the same value as RECNO( ) in an indexed table. ActiveRow returns zero if the grid doesn't have the focus or when you access a row outside the grid display.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Saturday, 30 January 2016 9:42 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
OK - strangely enough - when I was trying to review the issues and stepping thru the Method where the main processing takes place - that ActiveRow kept showing as Zero. But, now, in that Method - I simply put in a Wait statement and have it report what the ActiveRow - and now its showing a proper record # value. Very strange...
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Friday, January 29, 2016 5:20 PM To: profoxtech@leafe.com Subject: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Hey Ted,
Thanks for "Getting That For me".
So - yes, I decided to go the Grid route on this issue. I did look at the 1001/Ch 6 - but, in the webpage it refers to using sample code that came with the book.
However, I saw one of the links above it - from Foxite. I decided to implement that code. To be honest - I hadn't sub-classed before, but, I figured it out and made a Grid sub-class.
However, I'm having a problem in implementing the code. I implemented everything as stated on this webpage: https://www.foxite.com/faq/default.aspx?id=3#
I believe I implemented all the code correctly. However, I'm having a problem with the following lines: WITH THIS .nActiveRow = IIF(.ACTIVEROW = 0, .nActiveRow ,.ACTIVEROW) && Assign value to class property
Originally the 2nd line above was as follows: .nActiveRow =.ACTIVEROW && Assign value to class property
The problem is - value in ACTIVEROW is Always Zero (a property in the Grid ). I have NO Idea why its always Zero. In theory - if I change to another record - it should be giving the record #.
Any suggestions would be greatly appreciated.
Regards, Kurt
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Thursday, January 28, 2016 4:50 PM To: profoxtech@leafe.com Subject: Re: A Question of ListBoxes...
On Thu, Jan 28, 2016 at 4:04 PM, Kurt Wendt Kurt_Wendt@globetax.com wrote:
To a certain extent - I agree. If they want a Grid - maybe I should give
them one. That being said - I don't think there is a straightforward way in a Grid to Select Multiple items. Am I wrong? Although - After writing the last 2 sentences - some ideas were rolling around in my head about implementing a multi-select in a Grid. Since, at least with me - I know anything is possible - as I've done some interesting screen designs in the past!
Forgive me, but the answer is obviously: http://bfy.tw/3yWI
and again, I recommend 1001, Chapter 6 this time.
-- Ted Roche & Associates, LLC http://www.tedroche.com
[excessive quoting removed by server]
I was thinking somewhat along the same line of reasoning. And, now that I took the Wait Window out - it seems to be kind of working - but its VERY Slow. And, the last test - it just hung up VFP completely then crashed out!
But - I'm still working on it...
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Darren Sent: Friday, January 29, 2016 5:45 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Might be to do with focus.
From Help:
The ActiveRow property does not return the same value as RECNO( ) in an indexed table. ActiveRow returns zero if the grid doesn't have the focus or when you access a row outside the grid display.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Saturday, 30 January 2016 9:42 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
OK - strangely enough - when I was trying to review the issues and stepping thru the Method where the main processing takes place - that ActiveRow kept showing as Zero. But, now, in that Method - I simply put in a Wait statement and have it report what the ActiveRow - and now its showing a proper record # value. Very strange...
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Friday, January 29, 2016 5:20 PM To: profoxtech@leafe.com Subject: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Hey Ted,
Thanks for "Getting That For me".
So - yes, I decided to go the Grid route on this issue. I did look at the 1001/Ch 6 - but, in the webpage it refers to using sample code that came with the book.
However, I saw one of the links above it - from Foxite. I decided to implement that code. To be honest - I hadn't sub-classed before, but, I figured it out and made a Grid sub-class.
However, I'm having a problem in implementing the code. I implemented everything as stated on this webpage: https://www.foxite.com/faq/default.aspx?id=3#
I believe I implemented all the code correctly. However, I'm having a problem with the following lines: WITH THIS .nActiveRow = IIF(.ACTIVEROW = 0, .nActiveRow ,.ACTIVEROW) && Assign value to class property
Originally the 2nd line above was as follows: .nActiveRow =.ACTIVEROW && Assign value to class property
The problem is - value in ACTIVEROW is Always Zero (a property in the Grid ). I have NO Idea why its always Zero. In theory - if I change to another record - it should be giving the record #.
Any suggestions would be greatly appreciated.
Regards, Kurt
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Thursday, January 28, 2016 4:50 PM To: profoxtech@leafe.com Subject: Re: A Question of ListBoxes...
On Thu, Jan 28, 2016 at 4:04 PM, Kurt Wendt Kurt_Wendt@globetax.com wrote:
To a certain extent - I agree. If they want a Grid - maybe I should give
them one. That being said - I don't think there is a straightforward way in a Grid to Select Multiple items. Am I wrong? Although - After writing the last 2 sentences - some ideas were rolling around in my head about implementing a multi-select in a Grid. Since, at least with me - I know anything is possible - as I've done some interesting screen designs in the past!
Forgive me, but the answer is obviously: http://bfy.tw/3yWI
and again, I recommend 1001, Chapter 6 this time.
-- Ted Roche & Associates, LLC http://www.tedroche.com
[excessive quoting removed by server]
Yes - it really must have been a focus issue. And, now - Its not having the problem of being way slow - it actually seems to be working. So - luckily - it looks like I may have a viable Multi-Select Grid functioning. Hooray!
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Darren Sent: Friday, January 29, 2016 5:45 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Might be to do with focus.
From Help:
The ActiveRow property does not return the same value as RECNO( ) in an indexed table. ActiveRow returns zero if the grid doesn't have the focus or when you access a row outside the grid display.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Saturday, 30 January 2016 9:42 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
OK - strangely enough - when I was trying to review the issues and stepping thru the Method where the main processing takes place - that ActiveRow kept showing as Zero. But, now, in that Method - I simply put in a Wait statement and have it report what the ActiveRow - and now its showing a proper record # value. Very strange...
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Friday, January 29, 2016 5:20 PM To: profoxtech@leafe.com Subject: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Hey Ted,
Thanks for "Getting That For me".
So - yes, I decided to go the Grid route on this issue. I did look at the 1001/Ch 6 - but, in the webpage it refers to using sample code that came with the book.
However, I saw one of the links above it - from Foxite. I decided to implement that code. To be honest - I hadn't sub-classed before, but, I figured it out and made a Grid sub-class.
However, I'm having a problem in implementing the code. I implemented everything as stated on this webpage: https://www.foxite.com/faq/default.aspx?id=3#
I believe I implemented all the code correctly. However, I'm having a problem with the following lines: WITH THIS .nActiveRow = IIF(.ACTIVEROW = 0, .nActiveRow ,.ACTIVEROW) && Assign value to class property
Originally the 2nd line above was as follows: .nActiveRow =.ACTIVEROW && Assign value to class property
The problem is - value in ACTIVEROW is Always Zero (a property in the Grid ). I have NO Idea why its always Zero. In theory - if I change to another record - it should be giving the record #.
Any suggestions would be greatly appreciated.
Regards, Kurt
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Thursday, January 28, 2016 4:50 PM To: profoxtech@leafe.com Subject: Re: A Question of ListBoxes...
On Thu, Jan 28, 2016 at 4:04 PM, Kurt Wendt Kurt_Wendt@globetax.com wrote:
To a certain extent - I agree. If they want a Grid - maybe I should give
them one. That being said - I don't think there is a straightforward way in a Grid to Select Multiple items. Am I wrong? Although - After writing the last 2 sentences - some ideas were rolling around in my head about implementing a multi-select in a Grid. Since, at least with me - I know anything is possible - as I've done some interesting screen designs in the past!
Forgive me, but the answer is obviously: http://bfy.tw/3yWI
and again, I recommend 1001, Chapter 6 this time.
-- Ted Roche & Associates, LLC http://www.tedroche.com
[excessive quoting removed by server]
On 2016-01-29 17:20, Kurt Wendt wrote:
To be honest - I hadn't sub-classed before, but, I figured it out and made a Grid sub-class.
imo, subclassing is the BEST and will allow you to really love the Fox moreso. If I couldn't (or didn't) subclass, I might as well use VB. :-)
OOP is where's it at (still).
--Mike
Hey Mike - sorry I didn't see your reply till now.
At first I was hesitant to attempt to try and implement this particular solution - because it involved classes. I first tried to see if I could do it without doing the subclassing. But, then I saw that it required adding Methods and Properties to a Grid. I had done that with Forms - but, didn't know you couldn't do it with a Grid. So - I took at stab at how to sub-class, just a pure guess - since there were already a couple of visual classes in the project already - and was glad to see it was so easy to sub-class.
And - they say you Can't teach an Old Dog New Tricks. Well - this Dog just learned something new!
:-) -K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Saturday, January 30, 2016 6:32 PM To: profoxtech@leafe.com Subject: Re: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-01-29 17:20, Kurt Wendt wrote:
To be honest - I hadn't sub-classed before, but, I figured it out and made a Grid sub-class.
imo, subclassing is the BEST and will allow you to really love the Fox moreso. If I couldn't (or didn't) subclass, I might as well use VB. :-)
OOP is where's it at (still).
--Mike
Honestly....without subclassing, I think I'd hate programming. It surely would not be as enjoyable.
Check out the SaveSource and RestoreSource methods I posted in the ProFox downloads section to add to your grid subclass. Those are MUST HAVEs in my opinion so you never have to rebuild your grids after changing (requerying) the underlying cursor.
hth, --Mike
On 2016-02-02 08:58, Kurt Wendt wrote:
Hey Mike - sorry I didn't see your reply till now.
At first I was hesitant to attempt to try and implement this particular solution - because it involved classes. I first tried to see if I could do it without doing the subclassing. But, then I saw that it required adding Methods and Properties to a Grid. I had done that with Forms - but, didn't know you couldn't do it with a Grid. So
- I took at stab at how to sub-class, just a pure guess - since there
were already a couple of visual classes in the project already - and was glad to see it was so easy to sub-class.
And - they say you Can't teach an Old Dog New Tricks. Well - this Dog just learned something new!
:-) -K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Saturday, January 30, 2016 6:32 PM To: profoxtech@leafe.com Subject: Re: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-01-29 17:20, Kurt Wendt wrote:
To be honest - I hadn't sub-classed before, but, I figured it out and made a Grid sub-class.
imo, subclassing is the BEST and will allow you to really love the Fox moreso. If I couldn't (or didn't) subclass, I might as well use VB. :-)
OOP is where's it at (still).
--Mike
[excessive quoting removed by server]
Hey Mike - thanks so much for pointing me to your code downloads. I haven't gotten to the point of re-querying the grid - but, I WILL have to do exactly that - and at that point I will look at your code.
I'm actually having a Strange problem with this Grid now - in that it will at times crash the whole VFP application when I am testing out that Grid. But, I may have to post this in a new Thread. I'm trying some stuff out now - before I really post about this issue. But, it's a game stopper - since I can't possibly release this screen to the users if it crashes at times due to users interacting with this Grid!
So - more on this shortly...
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Tuesday, February 02, 2016 10:29 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Honestly....without subclassing, I think I'd hate programming. It surely would not be as enjoyable.
Check out the SaveSource and RestoreSource methods I posted in the ProFox downloads section to add to your grid subclass. Those are MUST HAVEs in my opinion so you never have to rebuild your grids after changing (requerying) the underlying cursor.
hth, --Mike
On 2016-02-02 08:58, Kurt Wendt wrote:
Hey Mike - sorry I didn't see your reply till now.
At first I was hesitant to attempt to try and implement this particular solution - because it involved classes. I first tried to see if I could do it without doing the subclassing. But, then I saw that it required adding Methods and Properties to a Grid. I had done that with Forms - but, didn't know you couldn't do it with a Grid. So
- I took at stab at how to sub-class, just a pure guess - since there
were already a couple of visual classes in the project already - and was glad to see it was so easy to sub-class.
And - they say you Can't teach an Old Dog New Tricks. Well - this Dog just learned something new!
:-) -K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Saturday, January 30, 2016 6:32 PM To: profoxtech@leafe.com Subject: Re: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-01-29 17:20, Kurt Wendt wrote:
To be honest - I hadn't sub-classed before, but, I figured it out and made a Grid sub-class.
imo, subclassing is the BEST and will allow you to really love the Fox moreso. If I couldn't (or didn't) subclass, I might as well use VB. :-)
OOP is where's it at (still).
--Mike
[excessive quoting removed by server]
Grids are tetchy critters and prone to blowing up with C5 errors, especially if you requery the datasource while its still associated with the object. In general, the tricks have been to temporarily reset it to nothing, rebuild your underlying datasource, and then reestablish the relationship to the grid object. Mike's save and restore source methods will probably go a long way to curing your grid ills.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Tuesday, February 02, 2016 10:33 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Hey Mike - thanks so much for pointing me to your code downloads. I haven't gotten to the point of re-querying the grid - but, I WILL have to do exactly that - and at that point I will look at your code.
I'm actually having a Strange problem with this Grid now - in that it will at times crash the whole VFP application when I am testing out that Grid. But, I may have to post this in a new Thread. I'm trying some stuff out now - before I really post about this issue. But, it's a game stopper - since I can't possibly release this screen to the users if it crashes at times due to users interacting with this Grid!
So - more on this shortly...
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Tuesday, February 02, 2016 10:29 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Honestly....without subclassing, I think I'd hate programming. It surely would not be as enjoyable.
Check out the SaveSource and RestoreSource methods I posted in the ProFox downloads section to add to your grid subclass. Those are MUST HAVEs in my opinion so you never have to rebuild your grids after changing (requerying) the underlying cursor.
hth, --Mike
Thanks for your input RK!
But, at this point - I'm not even doing a re-query yet. I'm just playing with getting proper functionality of the grid - and testing the multi-select feature.
FYI - on this particular screen - which was previously implemented w/2 ListBoxes - the users selects records on 1 listbox - then hits a button to have those records pushed over to the other listbox. And, its at THIS Point when I get working on implementing that button with the new Grid controls - Then I will need to requery. But, for now - I don't need to requery. So, I don't think that for now the requery is the issue I am currently having.
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye Sent: Tuesday, February 02, 2016 10:38 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Grids are tetchy critters and prone to blowing up with C5 errors, especially if you requery the datasource while its still associated with the object. In general, the tricks have been to temporarily reset it to nothing, rebuild your underlying datasource, and then reestablish the relationship to the grid object. Mike's save and restore source methods will probably go a long way to curing your grid ills.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Tuesday, February 02, 2016 10:33 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Hey Mike - thanks so much for pointing me to your code downloads. I haven't gotten to the point of re-querying the grid - but, I WILL have to do exactly that - and at that point I will look at your code.
I'm actually having a Strange problem with this Grid now - in that it will at times crash the whole VFP application when I am testing out that Grid. But, I may have to post this in a new Thread. I'm trying some stuff out now - before I really post about this issue. But, it's a game stopper - since I can't possibly release this screen to the users if it crashes at times due to users interacting with this Grid!
So - more on this shortly...
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Tuesday, February 02, 2016 10:29 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Honestly....without subclassing, I think I'd hate programming. It surely would not be as enjoyable.
Check out the SaveSource and RestoreSource methods I posted in the ProFox downloads section to add to your grid subclass. Those are MUST HAVEs in my opinion so you never have to rebuild your grids after changing (requerying) the underlying cursor.
hth, --Mike
out of interest, take a look at the datapicker (?) class in xsource - does exactly that with two listboxes
On 02/02/2016 21:18, Kurt Wendt wrote:
... was previously implemented w/2 ListBoxes - the users selects records on 1 listbox - then hits a button to have those records pushed over to the other listbox.
Well - the current version of the system has 2 listboxes. However, there are several changes that were requested - which can NOT be done with the Listbox: 1 - Easily resize the columns 2 - Click on a column header to allow user to sort data by that column
Both of these features are typically implemented in Grids. That's why I'm trying to implement the request using the Multi-Select Grid coding that was displayed on Foxite.
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of AndyHC Sent: Tuesday, February 02, 2016 12:01 PM To: profoxtech@leafe.com Subject: Re: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
out of interest, take a look at the datapicker (?) class in xsource - does exactly that with two listboxes
On 02/02/2016 21:18, Kurt Wendt wrote:
... was previously implemented w/2 ListBoxes - the users selects records on 1 listbox - then hits a button to have those records pushed over to the other listbox.
[excessive quoting removed by server]
Not to confuse the issue more but Craig Boyd has a brilliant VFP class called gridextras that gives you all kinds of functionality like column sorting, filtering, exporting, etc. You basically drop the class on your form, set a few properties and voila! Supergrid!
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Tuesday, February 02, 2016 12:06 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Well - the current version of the system has 2 listboxes. However, there are several changes that were requested - which can NOT be done with the Listbox: 1 - Easily resize the columns 2 - Click on a column header to allow user to sort data by that column
Both of these features are typically implemented in Grids. That's why I'm trying to implement the request using the Multi-Select Grid coding that was displayed on Foxite.
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of AndyHC Sent: Tuesday, February 02, 2016 12:01 PM To: profoxtech@leafe.com Subject: Re: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
out of interest, take a look at the datapicker (?) class in xsource - does exactly that with two listboxes
On 02/02/2016 21:18, Kurt Wendt wrote:
... was previously implemented w/2 ListBoxes - the users selects records on 1 listbox - then hits a button to have those records pushed over to the other listbox.
[excessive quoting removed by server]
Ouch - I wish I knew about that earlier! Maybe it would have been a better solution. Does it have a Multi-Select feature in this SuperGrid?
So - an additional follow-up to my last comments.
I've been doing testing & dev. using Two sessions of VFP. I Mod a screen in the one instance, but I Always run a test within the Other session. And, in the session where I test, I rebuild the APP using the BUILD command line option & then run the APP.
And, since I am constantly running the App in that session - I'm wondering if THAT has something to do with it - that I keep re-running the APP. So, just now as a Test - I compiled an EXE. And, I ran that EXE multiple times. I even went into that particular Form - which is accessed by a button on the main form, and ran that form that has the Grid - multiple times - each time going back to the primary form and selecting a different main data record. But, still - it did NOT Crash once.
So - maybe the crashing problem DOES have to do with re-running of the APP. Maybe something is being left behind, not cleaned up, after the App is run each time. Of course, I am just taking a WAG here as to the problem.
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye Sent: Tuesday, February 02, 2016 12:09 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Not to confuse the issue more but Craig Boyd has a brilliant VFP class called gridextras that gives you all kinds of functionality like column sorting, filtering, exporting, etc. You basically drop the class on your form, set a few properties and voila! Supergrid!
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Tuesday, February 02, 2016 12:06 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Well - the current version of the system has 2 listboxes. However, there are several changes that were requested - which can NOT be done with the Listbox: 1 - Easily resize the columns 2 - Click on a column header to allow user to sort data by that column
Both of these features are typically implemented in Grids. That's why I'm trying to implement the request using the Multi-Select Grid coding that was displayed on Foxite.
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of AndyHC Sent: Tuesday, February 02, 2016 12:01 PM To: profoxtech@leafe.com Subject: Re: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
out of interest, take a look at the datapicker (?) class in xsource - does exactly that with two listboxes
On 02/02/2016 21:18, Kurt Wendt wrote:
... was previously implemented w/2 ListBoxes - the users selects records on 1 listbox - then hits a button to have those records pushed over to the other listbox.
[excessive quoting removed by server]
OK, I was just reviewing the code in the custom Method within this sub-classed Grid - and I noticed the Comments on the following 3 lines of code: #DEFINE VK_lSHIFT 0x10 && Relocate to a header file #DEFINE VK_lCONTROL 0x11 && Relocate to a header file DECLARE INTEGER GetKeyState IN WIN32API INTEGER && Relocate to where WinAPI calls are declared
Although the Author of the code did Not specifically mention this on Foxite - it looks like I must change the code according to his comments above.
Is it possible that because the Define & Declare commands are happening MULTIPLE times - that this may be what is causing VFP to crash?
I haven't had much hands on experience with usage of the #Define command - although I have modified code here that HAS the commands in them - I just haven't added them much into the code myself...
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Tuesday, February 02, 2016 12:17 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Ouch - I wish I knew about that earlier! Maybe it would have been a better solution. Does it have a Multi-Select feature in this SuperGrid?
So - an additional follow-up to my last comments.
I've been doing testing & dev. using Two sessions of VFP. I Mod a screen in the one instance, but I Always run a test within the Other session. And, in the session where I test, I rebuild the APP using the BUILD command line option & then run the APP.
And, since I am constantly running the App in that session - I'm wondering if THAT has something to do with it - that I keep re-running the APP. So, just now as a Test - I compiled an EXE. And, I ran that EXE multiple times. I even went into that particular Form - which is accessed by a button on the main form, and ran that form that has the Grid - multiple times - each time going back to the primary form and selecting a different main data record. But, still - it did NOT Crash once.
So - maybe the crashing problem DOES have to do with re-running of the APP. Maybe something is being left behind, not cleaned up, after the App is run each time. Of course, I am just taking a WAG here as to the problem.
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye Sent: Tuesday, February 02, 2016 12:09 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Not to confuse the issue more but Craig Boyd has a brilliant VFP class called gridextras that gives you all kinds of functionality like column sorting, filtering, exporting, etc. You basically drop the class on your form, set a few properties and voila! Supergrid!
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Tuesday, February 02, 2016 12:06 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Well - the current version of the system has 2 listboxes. However, there are several changes that were requested - which can NOT be done with the Listbox: 1 - Easily resize the columns 2 - Click on a column header to allow user to sort data by that column
Both of these features are typically implemented in Grids. That's why I'm trying to implement the request using the Multi-Select Grid coding that was displayed on Foxite.
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of AndyHC Sent: Tuesday, February 02, 2016 12:01 PM To: profoxtech@leafe.com Subject: Re: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
out of interest, take a look at the datapicker (?) class in xsource - does exactly that with two listboxes
On 02/02/2016 21:18, Kurt Wendt wrote:
... was previously implemented w/2 ListBoxes - the users selects records on 1 listbox - then hits a button to have those records pushed over to the other listbox.
[excessive quoting removed by server]
On 2016-02-02 10:37, Richard Kaye wrote:
Grids are tetchy critters and prone to blowing up with C5 errors, especially if you requery the datasource while its still associated with the object. In general, the tricks have been to temporarily reset it to nothing, rebuild your underlying datasource, and then reestablish the relationship to the grid object. Mike's save and restore source methods will probably go a long way to curing your grid ills.
And to be fair again, I thank Paul Mrozowski...that's his code that I got from him in my brief Michigan adventure 10 years ago this year. :-)
It was a Coding Adventure??? :-)
Sent from my iPhone
On Feb 2, 2016, at 5:50 PM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
On 2016-02-02 10:37, Richard Kaye wrote: Grids are tetchy critters and prone to blowing up with C5 errors, especially if you requery the datasource while its still associated with the object. In general, the tricks have been to temporarily reset it to nothing, rebuild your underlying datasource, and then reestablish the relationship to the grid object. Mike's save and restore source methods will probably go a long way to curing your grid ills.
And to be fair again, I thank Paul Mrozowski...that's his code that I got from him in my brief Michigan adventure 10 years ago this year. :-)
[excessive quoting removed by server]
Interesting reminder!
I didn't think much about the underlying mechanism, and was coding like a blind followers. The tutorials and books out there didn't talk much about that underlying "darkness" neither. :)
I guess the C5 errors had something to do with memory allocation, conflicts if not leaks?
On Tue, Feb 2, 2016 at 11:37 PM, Richard Kaye rkaye@invaluable.com wrote:
Grids are tetchy critters and prone to blowing up with C5 errors, especially if you requery the datasource while its still associated with the object. In general, the tricks have been to temporarily reset it to nothing, rebuild your underlying datasource, and then reestablish the relationship to the grid object.
Man-wai Chang wrote on 2016-02-03:
Interesting reminder!
I didn't think much about the underlying mechanism, and was coding like a blind followers. The tutorials and books out there didn't talk much about that underlying "darkness" neither. :)
I guess the C5 errors had something to do with memory allocation, conflicts if not leaks?
On Tue, Feb 2, 2016 at 11:37 PM, Richard Kaye rkaye@invaluable.com
wrote:
Grids are tetchy critters and prone to blowing up with C5 errors,
especially if you
requery the datasource while its still associated with the object. In
general,
the tricks have been to temporarily reset it to nothing, rebuild your underlying datasource, and then reestablish the relationship to the
grid object.
Man-wai,
I would suspect the Dymanic properties that fire code to update specific controls within the grid may cause a C5 if the cursor is not carefully handled. The best way to prevent oddities is, either set the RecordSource to an empty string and back, or ZAP and INSERT/APPEND data back in to it.
Timers that fire, which then reference another object have been known to cause hard to reproduce errors, and a rare C5 for me.
Exiting out of code in the middle of a CATCH of the Try/Catch have caused a C5 for me.
Corrupt CDX files have caused a C5 for me.
ActiveX controls, those are my bane, with C5's. I can't reproduce them in house, but several customers get them.
Tracy Pearson PowerChurch Software
On 2016-02-03 11:15, Tracy Pearson wrote:
Man-wai,
I would suspect the Dymanic properties that fire code to update specific controls within the grid may cause a C5 if the cursor is not carefully handled. The best way to prevent oddities is, either set the RecordSource to an empty string and back, or ZAP and INSERT/APPEND data back in to it.
Be careful of the ZAP of grid sources, because if they're updatable views, and you somehow issue a tableupdate, you could be really screwing yourself by deleting data. Got bit many moons ago on that.
On 2016-02-02 10:33, Kurt Wendt wrote:
Hey Mike - thanks so much for pointing me to your code downloads. I haven't gotten to the point of re-querying the grid - but, I WILL have to do exactly that - and at that point I will look at your code.
I'm actually having a Strange problem with this Grid now - in that it will at times crash the whole VFP application when I am testing out that Grid. But, I may have to post this in a new Thread. I'm trying some stuff out now - before I really post about this issue. But, it's a game stopper - since I can't possibly release this screen to the users if it crashes at times due to users interacting with this Grid!
So - more on this shortly...
Are you getting a C000..05 error?
Nope - but, will have 2 elaborate more tomorrow - as I already left work...
-K-
Sent from my iPhone
On Feb 2, 2016, at 5:49 PM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
On 2016-02-02 10:33, Kurt Wendt wrote: Hey Mike - thanks so much for pointing me to your code downloads. I haven't gotten to the point of re-querying the grid - but, I WILL have to do exactly that - and at that point I will look at your code. I'm actually having a Strange problem with this Grid now - in that it will at times crash the whole VFP application when I am testing out that Grid. But, I may have to post this in a new Thread. I'm trying some stuff out now - before I really post about this issue. But, it's a game stopper - since I can't possibly release this screen to the users if it crashes at times due to users interacting with this Grid! So - more on this shortly...
Are you getting a C000..05 error?
[excessive quoting removed by server]
To be more specific about what happens.
As I am trying out the Grid & doing Multi-Selects, at times I get the spinning gizmo that replaces the mouse pointer/curser. But, it keeps on and keeps on spinning - then, if I click in the grid or on the screen - then entire session goes Hazy White. Then - if I click on that session again - I get the request about application not responding - Wait or Close.
I don't normally have these issues w/Grids. Could it be caused by the Sub-Classing of a Grid - or maybe the Code in the Grid???
There's no way I can have this happening when I move all the changes to Production - that would be Seriously BAD if it should happen in Prod! It would make Me look bad!
So - any help would be greatly appreciated.
TIA, -K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Tuesday, February 02, 2016 5:50 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-02 10:33, Kurt Wendt wrote:
Hey Mike - thanks so much for pointing me to your code downloads. I haven't gotten to the point of re-querying the grid - but, I WILL have to do exactly that - and at that point I will look at your code.
I'm actually having a Strange problem with this Grid now - in that it will at times crash the whole VFP application when I am testing out that Grid. But, I may have to post this in a new Thread. I'm trying some stuff out now - before I really post about this issue. But, it's a game stopper - since I can't possibly release this screen to the users if it crashes at times due to users interacting with this Grid!
So - more on this shortly...
Are you getting a C000..05 error?
[excessive quoting removed by server]
Kurt Wendt wrote on 2016-02-03:
To be more specific about what happens.
As I am trying out the Grid & doing Multi-Selects, at times I get the
spinning gizmo that replaces the mouse pointer/curser. But, it keeps on and keeps on spinning - then, if I click in the grid or on the screen - then entire session goes Hazy White. Then - if I click on that session again - I get the request about application not responding - Wait or Close.
I don't normally have these issues w/Grids. Could it be caused by the
Sub-Classing of a Grid - or maybe the Code in the Grid???
There's no way I can have this happening when I move all the changes to
Production - that would be Seriously BAD if it should happen in Prod! It would make Me look bad!
So - any help would be greatly appreciated.
TIA, -K-
Kurt,
It is acting like you are in a loop.
How do you test?
I launch a separate VFP session and run the CODE from it. (I use a custom config.fpw to launch the main prg for me.) This allows me to see things in the debugger. When a grid is involved, having focus on the debug window will often change the behavior seen.
Another way I test is start a separate VFP session with a custom config.fpw that launches startup.prg which will set up some variables and configurations, then launch the EXE.
Tracy Pearson PowerChurch Software
Tracy - I agree - it DOES look like code is running in an Infinite loop. But, that really shouldn't be happening.
When I test - I run the APP - not the EXE - and in another session of VFP where I am doing Editing of the Forms. And, I simply run the main system - then click a button that launches another form that has the custom subclassed Grid on it. At that point - I'm just running the system, and I'm not looking at code via the Debugger.
Thanks, Kurt
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Tracy Pearson Sent: Wednesday, February 03, 2016 10:53 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Kurt Wendt wrote on 2016-02-03:
To be more specific about what happens.
As I am trying out the Grid & doing Multi-Selects, at times I get the
spinning gizmo that replaces the mouse pointer/curser. But, it keeps on and keeps on spinning - then, if I click in the grid or on the screen - then entire session goes Hazy White. Then - if I click on that session again - I get the request about application not responding - Wait or Close.
I don't normally have these issues w/Grids. Could it be caused by the
Sub-Classing of a Grid - or maybe the Code in the Grid???
There's no way I can have this happening when I move all the changes to
Production - that would be Seriously BAD if it should happen in Prod! It would make Me look bad!
So - any help would be greatly appreciated.
TIA, -K-
Kurt,
It is acting like you are in a loop.
How do you test?
I launch a separate VFP session and run the CODE from it. (I use a custom config.fpw to launch the main prg for me.) This allows me to see things in the debugger. When a grid is involved, having focus on the debug window will often change the behavior seen.
Another way I test is start a separate VFP session with a custom config.fpw that launches startup.prg which will set up some variables and configurations, then launch the EXE.
Tracy Pearson
Kurt Wendt wrote on 2016-02-03:
Tracy - I agree - it DOES look like code is running in an Infinite loop.
But, that really shouldn't be happening.
When I test - I run the APP - not the EXE - and in another session of VFP
where I am doing Editing of the Forms. And, I simply run the main system - then click a button that launches another form that has the custom subclassed Grid on it. At that point - I'm just running the system, and I'm not looking at code via the Debugger.
Thanks, Kurt
Kurt,
Check out the SET ESCAPE Command. When you are running the APP, you may be in a VFP session that allows the debug window. Pressing the escape key, may allow you to stop the loop and see what might be the root cause.
You may need to SET ESCAPE ON when the form initializes for testing.
Tracy Pearson PowerChurch Software
Thanks Tracy - that's a good idea about the Escape key. I will Definitely try this out if I notice this crashing issue happening again - and may just Set Escape on in advance - just in case...
Another issue related to this SubClassed Grid. IN the Init of the Form in which the Grid exists - I'm updating things for this grid - like the column header names & formatting of the headers. This is also where I set the RecordSource. So - while I'm updating the Headers - I want to then update the Click or DoubleClick method to contain the code that will allow resorting of the data based upon that column/field. But, at runtime - can I push code into something like the Click Method of the Grid Column? I'm getting errors in VFP when trying to do so. I'm not sure if it's possible to do - or I'm just doing it wrong?
At this moment - as snippet of the code is as such: WITH Thisform.Cash_Grid .Column4.Header1.DblClick = .Data_resort(.Column4.ControlSource)
Thanks! -K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Tracy Pearson Sent: Wednesday, February 03, 2016 12:40 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Kurt Wendt wrote on 2016-02-03:
Tracy - I agree - it DOES look like code is running in an Infinite loop.
But, that really shouldn't be happening.
When I test - I run the APP - not the EXE - and in another session of VFP
where I am doing Editing of the Forms. And, I simply run the main system - then click a button that launches another form that has the custom subclassed Grid on it. At that point - I'm just running the system, and I'm not looking at code via the Debugger.
Thanks, Kurt
Kurt,
Check out the SET ESCAPE Command. When you are running the APP, you may be in a VFP session that allows the debug window. Pressing the escape key, may allow you to stop the loop and see what might be the root cause.
You may need to SET ESCAPE ON when the form initializes for testing.
Tracy Pearson PowerChurch Software
[excessive quoting removed by server]
Running into a meeting so apologies for the brevity. Check out BINDEVENTS.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Wednesday, February 03, 2016 12:59 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Thanks Tracy - that's a good idea about the Escape key. I will Definitely try this out if I notice this crashing issue happening again - and may just Set Escape on in advance - just in case...
Another issue related to this SubClassed Grid. IN the Init of the Form in which the Grid exists - I'm updating things for this grid - like the column header names & formatting of the headers. This is also where I set the RecordSource. So - while I'm updating the Headers - I want to then update the Click or DoubleClick method to contain the code that will allow resorting of the data based upon that column/field. But, at runtime - can I push code into something like the Click Method of the Grid Column? I'm getting errors in VFP when trying to do so. I'm not sure if it's possible to do - or I'm just doing it wrong?
At this moment - as snippet of the code is as such: WITH Thisform.Cash_Grid .Column4.Header1.DblClick = .Data_resort(.Column4.ControlSource)
Thanks! -K-
Thanks - will do. Good luck in meeting! And thanks for such a rapid reply!!
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye Sent: Wednesday, February 03, 2016 1:00 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Running into a meeting so apologies for the brevity. Check out BINDEVENTS.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Wednesday, February 03, 2016 12:59 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Thanks Tracy - that's a good idea about the Escape key. I will Definitely try this out if I notice this crashing issue happening again - and may just Set Escape on in advance - just in case...
Another issue related to this SubClassed Grid. IN the Init of the Form in which the Grid exists - I'm updating things for this grid - like the column header names & formatting of the headers. This is also where I set the RecordSource. So - while I'm updating the Headers - I want to then update the Click or DoubleClick method to contain the code that will allow resorting of the data based upon that column/field. But, at runtime - can I push code into something like the Click Method of the Grid Column? I'm getting errors in VFP when trying to do so. I'm not sure if it's possible to do - or I'm just doing it wrong?
At this moment - as snippet of the code is as such: WITH Thisform.Cash_Grid .Column4.Header1.DblClick = .Data_resort(.Column4.ControlSource)
Thanks! -K-
[excessive quoting removed by server]
On 2016-02-03 12:58, Kurt Wendt wrote:
Thanks Tracy - that's a good idea about the Escape key. I will Definitely try this out if I notice this crashing issue happening again - and may just Set Escape on in advance - just in case...
You're using VFP9SP2 latest patch, right?
Another issue related to this SubClassed Grid. IN the Init of the Form in which the Grid exists - I'm updating things for this grid - like the column header names & formatting of the headers. This is also where I set the RecordSource. So - while I'm updating the Headers - I want to then update the Click or DoubleClick method to contain the code that will allow resorting of the data based upon that column/field. But, at runtime - can I push code into something like the Click Method of the Grid Column? I'm getting errors in VFP when trying to do so. I'm not sure if it's possible to do - or I'm just doing it wrong?
At this moment - as snippet of the code is as such: WITH Thisform.Cash_Grid .Column4.Header1.DblClick = .Data_resort(.Column4.ControlSource)
Create a custom method and call that instead. That's cleaner. Also, that grid class iirc sets the column names for you if you set lSetColumns = .T.
For sorting, here's a method in my frmBase form class called from the column.Header1.Click event:
PARAMETERS toColumn
this.cOrder = toColumn.Name && mjb 05-02-14
*** mjb 04/14/14 - took from HDIRT's frmbase togglesortorder method LOCAL loException as Exception, lnRegColor as Integer, lnSelColor as Integer, lcCmd as String, lnOldArea as Integer, liNumTags as Integer, ; lcTagName as String, lcSeekValue as String, oColumn as Column, lcCursor as String, loGrid as Grid, lcAscDesc as String LOCAL ARRAY laTags[1] lnOldArea = SELECT() && save current work area lnRegColor = RGB(0,0,0) && could make this meta-data later too lnSelColor = RGB(0,0,255) lcOrder = toColumn.tag IF this.lCreateTagOnFly AND EMPTY(lcOrder) THEN lcOrder = toColumn.Name toColumn.Tag = lcOrder ENDIF loGrid = toColumn.Parent lcCursor = loGrid.RecordSource IF !EMPTY(lcOrder) AND !EMPTY(lcCursor) THEN SELECT (lcCursor) TRY *** mjb 08/09/2012 - see if index exists and add it on-the-fly if necessary liNumTags = ATAGINFO(laTags) IF LEN(lcOrder) > 10 OR GETWORDCOUNT(lcOrder) > 1 THEN IF NOT USED("TagsCursor") THEN CREATE CURSOR TagsCursor (cCursor C(50), cOrder C(75), cTag C(10)) INDEX on cCursor + cOrder TAG MyOrder ENDIF lcSeekValue = PADR(lcCursor,50) + PADR(lcOrder,75) IF SEEK(lcSeekValue,"TagsCursor","MyOrder") THEN && grab tag name lcTagName = ALLTRIM(TagsCursor.cTag) ELSE && not found yet...create tag and add to cursor lcTagName = SYS(2015) INSERT INTO TagsCursor VALUES (lcCursor,lcOrder,lcTagName) ENDIF && SEEK(..) ELSE && ok length..use fieldname passed lcTagName = lcOrder ENDIF && LEN(lcOrder) > 10
IF ASCAN(laTags,UPPER(lcTagName)) = 0 THEN && tag doesn't exist...create it on the fly IF GETWORDCOUNT(lcOrder) = 1 THEN && just simple tag lcCmd = "INDEX ON " + lcOrder + " TAG " + lcTagName + [ ASCENDING] ELSE && expression built * set lcTagName to be LAST word in command which is tag name lcTagName = GETWORDNUM(lcOrder,GETWORDCOUNT(lcOrder)) IF INLIST(UPPER(lcTagName),'ASCENDING','DESCENDING','ASC','DESC') THEN && get word prior lcTagName = GETWORDNUM(lcOrder,GETWORDCOUNT(lcOrder)-1) ENDIF && INLIST(UPPER(lcTagName),'ASCENDING','DESCENDING','ASC','DESC') THEN && get word prior * need to update TagsCursor since redefining tag name set there earlier IF SEEK(PADR(lcCursor,50) + PADR(lcOrder,75),"TagsCursor","MyOrder") THEN REPLACE cTag WITH lcTagName IN TagsCursor ELSE SET STEP ON * shouldn't happen ENDIF lcCmd = lcOrder ENDIF SELECT (lcCursor) &lcCmd ENDIF && ASCAN(laTags,UPPER(lcTagName)) = 0
SET ORDER TO (lcTagName) IN (lcCursor) && mjb 12-18-14
*** mjb 05/17/2014 - grabbed from ToggleSortOrder as it wasn't toggling asc/desc as I expected IF ORDER() = ALLTRIM(UPPER(lcTagName)) THEN IF this.Visible THEN IF this.cAscDesc = 'ASCENDING' THEN SET ORDER TO (lcTagName) IN (lcCursor) DESCENDING this.cAscDesc = "DESCENDING" ELSE SET ORDER TO (lcTagName) IN (lcCursor) ASCENDING this.cAscDesc = "ASCENDING" ENDIF && DESCENDING() ELSE IF NOT EMPTY(this.cAscDesc) THEN lcAscDesc = ALLTRIM(this.cAscDesc) SET ORDER TO (lcTagName) IN (lcCursor) &lcAscDesc this.cAscDesc = 'ASCENDING' ENDIF && NOT EMPTY(this.cAscDesc) ENDIF && this.visible ENDIF && ORDER() = ALLTRIM(UPPER(lcTagName))
SELECT (lcCursor) LOCATE && mjb 03-01-05 send to top when changing order
FOR EACH oColumn IN loGrid.Columns oColumn.Header1.FontBold = LOWER(oColumn.Tag) = LOWER(lcOrder) IF oColumn.Header1.FontBold THEN && make backcolor use different color to show selected order column (mjb 08-16-05) oColumn.Header1.ForeColor = lnSelColor ELSE oColumn.Header1.ForeColor = lnRegColor ENDIF ENDFOR loGrid.refresh()
CATCH TO loException WHEN loException.ErrorNo = 1683 && no index tag with this name...ignore IF _vfp.StartMode = 0 THEN MESSAGEBOX(loException.Message,16,"Problem") ENDIF
CATCH TO loException MESSAGEBOX(loException.Message,16,"Problem") SET STEP ON ENDTRY ENDIF && !EMPTY(lcOrder) SELECT (lnOldArea) && restore previous work area
Mike - thanks for all your input.
FYI - VFPSP2 v 9.00.0000.5815
I've been testing of code on this test Form - and on there I have a Regular Grid and the subclassed Grid. So, I've been testing code on the regular grid - and have the current functionality to sort the data by hitting column header. Its just getting that similar code applied to that subclassed Grid that seems to be the issue. Of course, yeah, things will have to be implemented a bit differently.
That method, Data_resort, actually is the custom Method of the subclassed Grid - which will handle the sorting.
Am trying out the BindEvent now, but, may resort to using your code below. Will report back on my progress...
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Wednesday, February 03, 2016 2:24 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-03 12:58, Kurt Wendt wrote:
Thanks Tracy - that's a good idea about the Escape key. I will Definitely try this out if I notice this crashing issue happening again - and may just Set Escape on in advance - just in case...
You're using VFP9SP2 latest patch, right?
Another issue related to this SubClassed Grid. IN the Init of the Form in which the Grid exists - I'm updating things for this grid - like the column header names & formatting of the headers. This is also where I set the RecordSource. So - while I'm updating the Headers - I want to then update the Click or DoubleClick method to contain the code that will allow resorting of the data based upon that column/field. But, at runtime - can I push code into something like the Click Method of the Grid Column? I'm getting errors in VFP when trying to do so. I'm not sure if it's possible to do - or I'm just doing it wrong?
At this moment - as snippet of the code is as such: WITH Thisform.Cash_Grid .Column4.Header1.DblClick = .Data_resort(.Column4.ControlSource)
Create a custom method and call that instead. That's cleaner. Also, that grid class iirc sets the column names for you if you set lSetColumns = .T.
For sorting, here's a method in my frmBase form class called from the column.Header1.Click event:
PARAMETERS toColumn
this.cOrder = toColumn.Name && mjb 05-02-14
*** mjb 04/14/14 - took from HDIRT's frmbase togglesortorder method LOCAL loException as Exception, lnRegColor as Integer, lnSelColor as Integer, lcCmd as String, lnOldArea as Integer, liNumTags as Integer, ; lcTagName as String, lcSeekValue as String, oColumn as Column, lcCursor as String, loGrid as Grid, lcAscDesc as String LOCAL ARRAY laTags[1] lnOldArea = SELECT() && save current work area lnRegColor = RGB(0,0,0) && could make this meta-data later too lnSelColor = RGB(0,0,255) lcOrder = toColumn.tag IF this.lCreateTagOnFly AND EMPTY(lcOrder) THEN lcOrder = toColumn.Name toColumn.Tag = lcOrder ENDIF loGrid = toColumn.Parent lcCursor = loGrid.RecordSource IF !EMPTY(lcOrder) AND !EMPTY(lcCursor) THEN SELECT (lcCursor) TRY *** mjb 08/09/2012 - see if index exists and add it on-the-fly if necessary liNumTags = ATAGINFO(laTags) IF LEN(lcOrder) > 10 OR GETWORDCOUNT(lcOrder) > 1 THEN IF NOT USED("TagsCursor") THEN CREATE CURSOR TagsCursor (cCursor C(50), cOrder C(75), cTag C(10)) INDEX on cCursor + cOrder TAG MyOrder ENDIF lcSeekValue = PADR(lcCursor,50) + PADR(lcOrder,75) IF SEEK(lcSeekValue,"TagsCursor","MyOrder") THEN && grab tag name lcTagName = ALLTRIM(TagsCursor.cTag) ELSE && not found yet...create tag and add to cursor lcTagName = SYS(2015) INSERT INTO TagsCursor VALUES (lcCursor,lcOrder,lcTagName) ENDIF && SEEK(..) ELSE && ok length..use fieldname passed lcTagName = lcOrder ENDIF && LEN(lcOrder) > 10
IF ASCAN(laTags,UPPER(lcTagName)) = 0 THEN && tag doesn't exist...create it on the fly IF GETWORDCOUNT(lcOrder) = 1 THEN && just simple tag lcCmd = "INDEX ON " + lcOrder + " TAG " + lcTagName + [ ASCENDING] ELSE && expression built * set lcTagName to be LAST word in command which is tag name lcTagName = GETWORDNUM(lcOrder,GETWORDCOUNT(lcOrder)) IF INLIST(UPPER(lcTagName),'ASCENDING','DESCENDING','ASC','DESC') THEN && get word prior lcTagName = GETWORDNUM(lcOrder,GETWORDCOUNT(lcOrder)-1) ENDIF && INLIST(UPPER(lcTagName),'ASCENDING','DESCENDING','ASC','DESC') THEN && get word prior * need to update TagsCursor since redefining tag name set there earlier IF SEEK(PADR(lcCursor,50) + PADR(lcOrder,75),"TagsCursor","MyOrder") THEN REPLACE cTag WITH lcTagName IN TagsCursor ELSE SET STEP ON * shouldn't happen ENDIF lcCmd = lcOrder ENDIF SELECT (lcCursor) &lcCmd ENDIF && ASCAN(laTags,UPPER(lcTagName)) = 0
SET ORDER TO (lcTagName) IN (lcCursor) && mjb 12-18-14
*** mjb 05/17/2014 - grabbed from ToggleSortOrder as it wasn't toggling asc/desc as I expected IF ORDER() = ALLTRIM(UPPER(lcTagName)) THEN IF this.Visible THEN IF this.cAscDesc = 'ASCENDING' THEN SET ORDER TO (lcTagName) IN (lcCursor) DESCENDING this.cAscDesc = "DESCENDING" ELSE SET ORDER TO (lcTagName) IN (lcCursor) ASCENDING this.cAscDesc = "ASCENDING" ENDIF && DESCENDING() ELSE IF NOT EMPTY(this.cAscDesc) THEN lcAscDesc = ALLTRIM(this.cAscDesc) SET ORDER TO (lcTagName) IN (lcCursor) &lcAscDesc this.cAscDesc = 'ASCENDING' ENDIF && NOT EMPTY(this.cAscDesc) ENDIF && this.visible ENDIF && ORDER() = ALLTRIM(UPPER(lcTagName))
SELECT (lcCursor) LOCATE && mjb 03-01-05 send to top when changing order
FOR EACH oColumn IN loGrid.Columns oColumn.Header1.FontBold = LOWER(oColumn.Tag) = LOWER(lcOrder) IF oColumn.Header1.FontBold THEN && make backcolor use different color to show selected order column (mjb 08-16-05) oColumn.Header1.ForeColor = lnSelColor ELSE oColumn.Header1.ForeColor = lnRegColor ENDIF ENDFOR loGrid.refresh()
CATCH TO loException WHEN loException.ErrorNo = 1683 && no index tag with this name...ignore IF _vfp.StartMode = 0 THEN MESSAGEBOX(loException.Message,16,"Problem") ENDIF
CATCH TO loException MESSAGEBOX(loException.Message,16,"Problem") SET STEP ON ENDTRY ENDIF && !EMPTY(lcOrder) SELECT (lnOldArea) && restore previous work area
[excessive quoting removed by server]
On 2016-02-03 14:51, Kurt Wendt wrote:
Mike - thanks for all your input.
FYI - VFPSP2 v 9.00.0000.5815
https://www.berezniker.com/content/pages/visual-foxpro/vfp-90-versions
I've been testing of code on this test Form - and on there I have a Regular Grid and the subclassed Grid. So, I've been testing code on the regular grid - and have the current functionality to sort the data by hitting column header. Its just getting that similar code applied to that subclassed Grid that seems to be the issue. Of course, yeah, things will have to be implemented a bit differently.
That method, Data_resort, actually is the custom Method of the subclassed Grid - which will handle the sorting.
How about putting "thisform.Data_Resort()" in the Whatever.Click event?
Am trying out the BindEvent now, but, may resort to using your code below. Will report back on my progress...
I'm sure BindEvent is great as many greats here suggest it, but I never got into it.
Wow - didn't realize I was 3 Hotfixes behind! But, I don't control it here.
I just spoke to my manager about it - and, no - its not going to happen - no updating with HotFixes. No way to know if the hotfixes actually break something that was working - and she said we just can't take that chance.
I actually WANTED to put that Data_Resort() call directly into a Click event - but, the Click Events and the Columns are not available at design time in the subclassed Grid.
AS for the BindEvent. I tried it. The Method I created is at the main Grid level of the subclasses Grid. I did the BindEvent in Init of the Form. At that point the Columns & Click events in the subclassed Grid are accessible after I set the RecordSource. So I did a Bind of a Method to the Click Event. Problem is - when its actually running - and it runs the Event - within that Event as its running - its at the Grid level and NOT the Column level. So at that point I can't actually pass the Column ControlSource to let the code know Which field the Sort needs to be based upon.
So - as of now - my attempt to use the BindEvent actually failed...
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Wednesday, February 03, 2016 3:56 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-03 14:51, Kurt Wendt wrote:
Mike - thanks for all your input.
FYI - VFPSP2 v 9.00.0000.5815
https://www.berezniker.com/content/pages/visual-foxpro/vfp-90-versions
I've been testing of code on this test Form - and on there I have a Regular Grid and the subclassed Grid. So, I've been testing code on the regular grid - and have the current functionality to sort the data by hitting column header. Its just getting that similar code applied to that subclassed Grid that seems to be the issue. Of course, yeah, things will have to be implemented a bit differently.
That method, Data_resort, actually is the custom Method of the subclassed Grid - which will handle the sorting.
How about putting "thisform.Data_Resort()" in the Whatever.Click event?
Am trying out the BindEvent now, but, may resort to using your code below. Will report back on my progress...
I'm sure BindEvent is great as many greats here suggest it, but I never got into it.
[excessive quoting removed by server]
Look into AEVENTS() to see where the event originated.
Fred
On Wed, Feb 3, 2016 at 2:45 PM, Kurt Wendt Kurt_Wendt@globetax.com wrote:
Wow - didn't realize I was 3 Hotfixes behind! But, I don't control it here.
I just spoke to my manager about it - and, no - its not going to happen - no updating with HotFixes. No way to know if the hotfixes actually break something that was working - and she said we just can't take that chance.
I actually WANTED to put that Data_Resort() call directly into a Click event - but, the Click Events and the Columns are not available at design time in the subclassed Grid.
AS for the BindEvent. I tried it. The Method I created is at the main Grid level of the subclasses Grid. I did the BindEvent in Init of the Form. At that point the Columns & Click events in the subclassed Grid are accessible after I set the RecordSource. So I did a Bind of a Method to the Click Event. Problem is - when its actually running - and it runs the Event - within that Event as its running - its at the Grid level and NOT the Column level. So at that point I can't actually pass the Column ControlSource to let the code know Which field the Sort needs to be based upon.
So - as of now - my attempt to use the BindEvent actually failed...
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Wednesday, February 03, 2016 3:56 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-03 14:51, Kurt Wendt wrote:
Mike - thanks for all your input.
FYI - VFPSP2 v 9.00.0000.5815
https://www.berezniker.com/content/pages/visual-foxpro/vfp-90-versions
I've been testing of code on this test Form - and on there I have a Regular Grid and the subclassed Grid. So, I've been testing code on the regular grid - and have the current functionality to sort the data by hitting column header. Its just getting that similar code applied to that subclassed Grid that seems to be the issue. Of course, yeah, things will have to be implemented a bit differently.
That method, Data_resort, actually is the custom Method of the subclassed Grid - which will handle the sorting.
How about putting "thisform.Data_Resort()" in the Whatever.Click event?
Am trying out the BindEvent now, but, may resort to using your code below. Will report back on my progress...
I'm sure BindEvent is great as many greats here suggest it, but I never got into it.
[excessive quoting removed by server]
The init of your grid object would generally be the place where you want to put your bindevents for your grid controls. Let's say you have a form method called handleGridClicks. In that method, you put whatever code you need that you want to have fire when clicking on some contained control (i.e. column header). All the contained controls in your grid will be instantiated by the time you get to init of the grid itself.
BINDEVENT(this,[Click],this.Parent,[handleGridClicks]) BINDEVENT(this,[DblClick],this.Parent,[handleGridClicks])
If you reset the grid's data source using whatever strategy you've come up with (i.e. Mike's functions), you also need to unbind your events when you clear the source and then bind them again after you've got everything reset.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Wednesday, February 03, 2016 4:45 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Wow - didn't realize I was 3 Hotfixes behind! But, I don't control it here.
I just spoke to my manager about it - and, no - its not going to happen - no updating with HotFixes. No way to know if the hotfixes actually break something that was working - and she said we just can't take that chance.
I actually WANTED to put that Data_Resort() call directly into a Click event - but, the Click Events and the Columns are not available at design time in the subclassed Grid.
AS for the BindEvent. I tried it. The Method I created is at the main Grid level of the subclasses Grid. I did the BindEvent in Init of the Form. At that point the Columns & Click events in the subclassed Grid are accessible after I set the RecordSource. So I did a Bind of a Method to the Click Event. Problem is - when its actually running - and it runs the Event - within that Event as its running - its at the Grid level and NOT the Column level. So at that point I can't actually pass the Column ControlSource to let the code know Which field the Sort needs to be based upon.
So - as of now - my attempt to use the BindEvent actually failed...
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Wednesday, February 03, 2016 3:56 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-03 14:51, Kurt Wendt wrote:
Mike - thanks for all your input.
FYI - VFPSP2 v 9.00.0000.5815
https://www.berezniker.com/content/pages/visual-foxpro/vfp-90-versions
I've been testing of code on this test Form - and on there I have a Regular Grid and the subclassed Grid. So, I've been testing code on the regular grid - and have the current functionality to sort the data by hitting column header. Its just getting that similar code applied to that subclassed Grid that seems to be the issue. Of course, yeah, things will have to be implemented a bit differently.
That method, Data_resort, actually is the custom Method of the subclassed Grid - which will handle the sorting.
How about putting "thisform.Data_Resort()" in the Whatever.Click event?
Am trying out the BindEvent now, but, may resort to using your code below. Will report back on my progress...
I'm sure BindEvent is great as many greats here suggest it, but I never got into it.
[excessive quoting removed by server]
And in case it's not clear that example assumes the grid container is in a form container. If it's in a pageframe you need to adjust the parental reference as appropriate.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye Sent: Wednesday, February 03, 2016 5:11 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
The init of your grid object would generally be the place where you want to put your bindevents for your grid controls. Let's say you have a form method called handleGridClicks. In that method, you put whatever code you need that you want to have fire when clicking on some contained control (i.e. column header). All the contained controls in your grid will be instantiated by the time you get to init of the grid itself.
BINDEVENT(this,[Click],this.Parent,[handleGridClicks]) BINDEVENT(this,[DblClick],this.Parent,[handleGridClicks])
If you reset the grid's data source using whatever strategy you've come up with (i.e. Mike's functions), you also need to unbind your events when you clear the source and then bind them again after you've got everything reset.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Wednesday, February 03, 2016 4:45 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Wow - didn't realize I was 3 Hotfixes behind! But, I don't control it here.
I just spoke to my manager about it - and, no - its not going to happen - no updating with HotFixes. No way to know if the hotfixes actually break something that was working - and she said we just can't take that chance.
I actually WANTED to put that Data_Resort() call directly into a Click event - but, the Click Events and the Columns are not available at design time in the subclassed Grid.
AS for the BindEvent. I tried it. The Method I created is at the main Grid level of the subclasses Grid. I did the BindEvent in Init of the Form. At that point the Columns & Click events in the subclassed Grid are accessible after I set the RecordSource. So I did a Bind of a Method to the Click Event. Problem is - when its actually running - and it runs the Event - within that Event as its running - its at the Grid level and NOT the Column level. So at that point I can't actually pass the Column ControlSource to let the code know Which field the Sort needs to be based upon.
So - as of now - my attempt to use the BindEvent actually failed...
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Wednesday, February 03, 2016 3:56 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-03 14:51, Kurt Wendt wrote:
Mike - thanks for all your input.
FYI - VFPSP2 v 9.00.0000.5815
https://www.berezniker.com/content/pages/visual-foxpro/vfp-90-versions
I've been testing of code on this test Form - and on there I have a Regular Grid and the subclassed Grid. So, I've been testing code on the regular grid - and have the current functionality to sort the data by hitting column header. Its just getting that similar code applied to that subclassed Grid that seems to be the issue. Of course, yeah, things will have to be implemented a bit differently.
That method, Data_resort, actually is the custom Method of the subclassed Grid - which will handle the sorting.
How about putting "thisform.Data_Resort()" in the Whatever.Click event?
Am trying out the BindEvent now, but, may resort to using your code below. Will report back on my progress...
I'm sure BindEvent is great as many greats here suggest it, but I never got into it.
[excessive quoting removed by server]
On 2016-02-03 16:45, Kurt Wendt wrote:
Wow - didn't realize I was 3 Hotfixes behind! But, I don't control it here.
I just spoke to my manager about it - and, no - its not going to happen - no updating with HotFixes. No way to know if the hotfixes actually break something that was working - and she said we just can't take that chance.
I actually WANTED to put that Data_Resort() call directly into a Click event - but, the Click Events and the Columns are not available at design time in the subclassed Grid.
AS for the BindEvent. I tried it. The Method I created is at the main Grid level of the subclasses Grid. I did the BindEvent in Init of the Form. At that point the Columns & Click events in the subclassed Grid are accessible after I set the RecordSource. So I did a Bind of a Method to the Click Event. Problem is - when its actually running - and it runs the Event - within that Event as its running - its at the Grid level and NOT the Column level. So at that point I can't actually pass the Column ControlSource to let the code know Which field the Sort needs to be based upon.
So - as of now - my attempt to use the BindEvent actually failed...
Usually this is my data requery event (handtyped for this email):
[thisform.GetRecords method] local liCnt as integer
if vartype(this.grd) = "O" then this.grd.SaveSource() endif
liCnt = this.obiz.MyRoutineThatGetsTheData()
if vartype(this.grd) = "O" then this.grd.RestoreSource() endif
That takes care of only running grid code when it's present.
Hey Mike - thanks for all your help on this topic. In the end, I will have to admit - I tossed out using a Sub-classed Grid. My manager, she was getting a bit worried about me implementing this in the system I was working on. Worried that things could go wrong with it in production. As folks mentioned here - my VFP is like 3 Hotfixes behind. But, they were not about to apply any of those hotfixes - for fear of breaking things. And, she felt that since the Classes stuff in VFP was the "Newer" type of tech. in VFP - put in later and at a time after M$ was already planning to Kill VFP. As such - she was wary.
Also, I was having problems implementing stuff - and that's why I was trying to use that BindEvent(). So - in the end - I used a Little bit of code & techniques from that Foxite code - but, applied it only to a regular Grid. And, there is no using of Shift-Click to select groups of records. Its simply implemented that if you click a record - its selected and highlighted. And, to select more records - you simply click on more records. That's it. Its basically working now - except one of the QA guys here is testing it for me - and he's testing on a Win10 machine - and the one of the two grids - upon selecting the record - the record gets blanked out - like its White on White. But, strangely - only on the one grid. Am still trying to fix that issue - then I will be done with this part of the project...
Regards, Kurt Wendt Consultant
Tel. +1-212-747-9100 www.GlobeTax.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Thursday, February 04, 2016 5:55 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-03 16:45, Kurt Wendt wrote:
Wow - didn't realize I was 3 Hotfixes behind! But, I don't control it here.
I just spoke to my manager about it - and, no - its not going to happen - no updating with HotFixes. No way to know if the hotfixes actually break something that was working - and she said we just can't take that chance.
I actually WANTED to put that Data_Resort() call directly into a Click event - but, the Click Events and the Columns are not available at design time in the subclassed Grid.
AS for the BindEvent. I tried it. The Method I created is at the main Grid level of the subclasses Grid. I did the BindEvent in Init of the Form. At that point the Columns & Click events in the subclassed Grid are accessible after I set the RecordSource. So I did a Bind of a Method to the Click Event. Problem is - when its actually running - and it runs the Event - within that Event as its running - its at the Grid level and NOT the Column level. So at that point I can't actually pass the Column ControlSource to let the code know Which field the Sort needs to be based upon.
So - as of now - my attempt to use the BindEvent actually failed...
Usually this is my data requery event (handtyped for this email):
[thisform.GetRecords method] local liCnt as integer
if vartype(this.grd) = "O" then this.grd.SaveSource() endif
liCnt = this.obiz.MyRoutineThatGetsTheData()
if vartype(this.grd) = "O" then this.grd.RestoreSource() endif
That takes care of only running grid code when it's present.
[excessive quoting removed by server]
The fact that anyone thinks anything in VFP is "newer" tech is absolutely hilarious!!!! :D
That new tech stuff ("Classes") were introduced I believe back in VFP3 (THREE). Others in the game longer than me can correct as needed.
On 2016-02-09 09:49, Kurt Wendt wrote:
Hey Mike - thanks for all your help on this topic. In the end, I will have to admit - I tossed out using a Sub-classed Grid. My manager, she was getting a bit worried about me implementing this in the system I was working on. Worried that things could go wrong with it in production. As folks mentioned here - my VFP is like 3 Hotfixes behind. But, they were not about to apply any of those hotfixes - for fear of breaking things. And, she felt that since the Classes stuff in VFP was the "Newer" type of tech. in VFP - put in later and at a time after M$ was already planning to Kill VFP. As such - she was wary.
Also, I was having problems implementing stuff - and that's why I was trying to use that BindEvent(). So - in the end - I used a Little bit of code & techniques from that Foxite code - but, applied it only to a regular Grid. And, there is no using of Shift-Click to select groups of records. Its simply implemented that if you click a record - its selected and highlighted. And, to select more records - you simply click on more records. That's it. Its basically working now - except one of the QA guys here is testing it for me - and he's testing on a Win10 machine - and the one of the two grids - upon selecting the record - the record gets blanked out - like its White on White. But, strangely - only on the one grid. Am still trying to fix that issue - then I will be done with this part of the project...
Regards, Kurt Wendt Consultant
Tel. +1-212-747-9100 www.GlobeTax.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Thursday, February 04, 2016 5:55 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-03 16:45, Kurt Wendt wrote:
Wow - didn't realize I was 3 Hotfixes behind! But, I don't control it here.
I just spoke to my manager about it - and, no - its not going to happen - no updating with HotFixes. No way to know if the hotfixes actually break something that was working - and she said we just can't take that chance.
I actually WANTED to put that Data_Resort() call directly into a Click event - but, the Click Events and the Columns are not available at design time in the subclassed Grid.
AS for the BindEvent. I tried it. The Method I created is at the main Grid level of the subclasses Grid. I did the BindEvent in Init of the Form. At that point the Columns & Click events in the subclassed Grid are accessible after I set the RecordSource. So I did a Bind of a Method to the Click Event. Problem is - when its actually running - and it runs the Event - within that Event as its running - its at the Grid level and NOT the Column level. So at that point I can't actually pass the Column ControlSource to let the code know Which field the Sort needs to be based upon.
So - as of now - my attempt to use the BindEvent actually failed...
Usually this is my data requery event (handtyped for this email):
[thisform.GetRecords method] local liCnt as integer
if vartype(this.grd) = "O" then this.grd.SaveSource() endif
liCnt = this.obiz.MyRoutineThatGetsTheData()
if vartype(this.grd) = "O" then this.grd.RestoreSource() endif
That takes care of only running grid code when it's present.
[excessive quoting removed by server]
mbsoftwaresolutions@mbsoftwaresolutions.com wrote on 2016-02-09:
The fact that anyone thinks anything in VFP is "newer" tech is absolutely hilarious!!!! :D
That new tech stuff ("Classes") were introduced I believe back in VFP3 (THREE). Others in the game longer than me can correct as needed.
Mike,
I believe VFP 3 had the ability to subclass. The BindEvents came in VFP 7 or 8. I never used 7, so I'm not certain. I know they existed in 8 and were enhanced in 9.
Tracy Pearson PowerChurch Software
Hi Fyi classes was introduced with VFP3 so not so new. Your 'blank' grid sounds like you need the safe select as introduced by Andy Kramek back in early '90's. Google for " safe select " in Foxite Rgds Koenp
Op dinsdag 9 februari 2016 heeft Kurt Wendt Kurt_Wendt@globetax.com het volgende geschreven:
Hey Mike - thanks for all your help on this topic. In the end, I will have to admit - I tossed out using a Sub-classed Grid. My manager, she was getting a bit worried about me implementing this in the system I was working on. Worried that things could go wrong with it in production. As folks mentioned here - my VFP is like 3 Hotfixes behind. But, they were not about to apply any of those hotfixes - for fear of breaking things. And, she felt that since the Classes stuff in VFP was the "Newer" type of tech. in VFP - put in later and at a time after M$ was already planning to Kill VFP. As such - she was wary.
Also, I was having problems implementing stuff - and that's why I was trying to use that BindEvent(). So - in the end - I used a Little bit of code & techniques from that Foxite code - but, applied it only to a regular Grid. And, there is no using of Shift-Click to select groups of records. Its simply implemented that if you click a record - its selected and highlighted. And, to select more records - you simply click on more records. That's it. Its basically working now - except one of the QA guys here is testing it for me - and he's testing on a Win10 machine - and the one of the two grids - upon selecting the record - the record gets blanked out - like its White on White. But, strangely - only on the one grid. Am still trying to fix that issue - then I will be done with this part of the project...
Regards, Kurt Wendt Consultant
Tel. +1-212-747-9100 www.GlobeTax.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com javascript:;] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com javascript:; Sent: Thursday, February 04, 2016 5:55 PM To: profoxtech@leafe.com javascript:; Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-03 16:45, Kurt Wendt wrote:
Wow - didn't realize I was 3 Hotfixes behind! But, I don't control it here.
I just spoke to my manager about it - and, no - its not going to happen - no updating with HotFixes. No way to know if the hotfixes actually break something that was working - and she said we just can't take that chance.
I actually WANTED to put that Data_Resort() call directly into a Click event - but, the Click Events and the Columns are not available at design time in the subclassed Grid.
AS for the BindEvent. I tried it. The Method I created is at the main Grid level of the subclasses Grid. I did the BindEvent in Init of the Form. At that point the Columns & Click events in the subclassed Grid are accessible after I set the RecordSource. So I did a Bind of a Method to the Click Event. Problem is - when its actually running - and it runs the Event - within that Event as its running - its at the Grid level and NOT the Column level. So at that point I can't actually pass the Column ControlSource to let the code know Which field the Sort needs to be based upon.
So - as of now - my attempt to use the BindEvent actually failed...
Usually this is my data requery event (handtyped for this email):
[thisform.GetRecords method] local liCnt as integer
if vartype(this.grd) = "O" then this.grd.SaveSource() endif
liCnt = this.obiz.MyRoutineThatGetsTheData()
if vartype(this.grd) = "O" then this.grd.RestoreSource() endif
That takes care of only running grid code when it's present.
[excessive quoting removed by server]
http://weblogs.foxite.com/andykramek/2005/03/19/using-a-safe-select-to-prese rve-your-grid/
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Koen Piller Sent: Tuesday, February 09, 2016 12:07 PM To: profoxtech@leafe.com Subject: Re: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Hi Fyi classes was introduced with VFP3 so not so new. Your 'blank' grid sounds like you need the safe select as introduced by Andy Kramek back in early '90's. Google for " safe select " in Foxite Rgds Koenp
The whole grid wasn't blank - only the lines that got selected. It was a background/foreground coloring issue. But, its an issue no more - it's been solved.
Regards, Kurt Wendt Consultant
Tel. +1-212-747-9100 www.GlobeTax.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Koen Piller Sent: Tuesday, February 09, 2016 2:07 PM To: profoxtech@leafe.com Subject: Re: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Hi Fyi classes was introduced with VFP3 so not so new. Your 'blank' grid sounds like you need the safe select as introduced by Andy Kramek back in early '90's. Google for " safe select " in Foxite Rgds Koenp
Op dinsdag 9 februari 2016 heeft Kurt Wendt Kurt_Wendt@globetax.com het volgende geschreven:
Hey Mike - thanks for all your help on this topic. In the end, I will have to admit - I tossed out using a Sub-classed Grid. My manager, she was getting a bit worried about me implementing this in the system I was working on. Worried that things could go wrong with it in production. As folks mentioned here - my VFP is like 3 Hotfixes behind. But, they were not about to apply any of those hotfixes - for fear of breaking things. And, she felt that since the Classes stuff in VFP was the "Newer" type of tech. in VFP - put in later and at a time after M$ was already planning to Kill VFP. As such - she was wary.
Also, I was having problems implementing stuff - and that's why I was trying to use that BindEvent(). So - in the end - I used a Little bit of code & techniques from that Foxite code - but, applied it only to a regular Grid. And, there is no using of Shift-Click to select groups of records. Its simply implemented that if you click a record - its selected and highlighted. And, to select more records - you simply click on more records. That's it. Its basically working now - except one of the QA guys here is testing it for me - and he's testing on a Win10 machine - and the one of the two grids - upon selecting the record - the record gets blanked out - like its White on White. But, strangely - only on the one grid. Am still trying to fix that issue - then I will be done with this part of the project...
Regards, Kurt Wendt Consultant
Tel. +1-212-747-9100 www.GlobeTax.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com javascript:;] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com javascript:; Sent: Thursday, February 04, 2016 5:55 PM To: profoxtech@leafe.com javascript:; Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-03 16:45, Kurt Wendt wrote:
Wow - didn't realize I was 3 Hotfixes behind! But, I don't control it here.
I just spoke to my manager about it - and, no - its not going to happen - no updating with HotFixes. No way to know if the hotfixes actually break something that was working - and she said we just can't take that chance.
I actually WANTED to put that Data_Resort() call directly into a Click event - but, the Click Events and the Columns are not available at design time in the subclassed Grid.
AS for the BindEvent. I tried it. The Method I created is at the main Grid level of the subclasses Grid. I did the BindEvent in Init of the Form. At that point the Columns & Click events in the subclassed Grid are accessible after I set the RecordSource. So I did a Bind of a Method to the Click Event. Problem is - when its actually running - and it runs the Event - within that Event as its running - its at the Grid level and NOT the Column level. So at that point I can't actually pass the Column ControlSource to let the code know Which field the Sort needs to be based upon.
So - as of now - my attempt to use the BindEvent actually failed...
Usually this is my data requery event (handtyped for this email):
[thisform.GetRecords method] local liCnt as integer
if vartype(this.grd) = "O" then this.grd.SaveSource() endif
liCnt = this.obiz.MyRoutineThatGetsTheData()
if vartype(this.grd) = "O" then this.grd.RestoreSource() endif
That takes care of only running grid code when it's present.
[excessive quoting removed by server]
On 2016-02-09 15:40, Kurt Wendt wrote:
The whole grid wasn't blank - only the lines that got selected. It was a background/foreground coloring issue. But, its an issue no more - it's been solved.
Glad you solved it, Kurt. Did you use the DynamicBack/Fore -Color thingies?
Yes, it was using the Dynamic SETALL functionality. Not sure why 1 Grid was working differently than the other. I had implement the code from the Foxite page - and it had a case statement to set the colors based upon what OS the app was running on - be it 2K, Vista, Win7 etc. So - I changed it to simply default to the Win7 code option - since I know we would NOT be running stuff Older than Win7. Then all was finally working correctly. All's well that Ends well...
Regards, Kurt Wendt Consultant
Tel. +1-212-747-9100 www.GlobeTax.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Wednesday, February 10, 2016 1:34 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-09 15:40, Kurt Wendt wrote:
The whole grid wasn't blank - only the lines that got selected. It was a background/foreground coloring issue. But, its an issue no more - it's been solved.
Glad you solved it, Kurt. Did you use the DynamicBack/Fore -Color thingies?
[excessive quoting removed by server]
mbsoftwaresolutions@mbsoftwaresolutions.com wrote on 2016-02-03:
On 2016-02-03 14:51, Kurt Wendt wrote: Mike - thanks for all your input.
FYI - VFPSP2 v 9.00.0000.5815
https://www.berezniker.com/content/pages/visual-foxpro/vfp-90-versions
I've been testing of code on this test Form - and on there I have a Regular Grid and the subclassed Grid. So, I've been testing code on the regular grid - and have the current functionality to sort the data by hitting column header. Its just getting that similar code applied to that subclassed Grid that seems to be the issue. Of course, yeah, things will have to be implemented a bit differently.
That method, Data_resort, actually is the custom Method of the subclassed Grid - which will handle the sorting.
How about putting "thisform.Data_Resort()" in the Whatever.Click event?
Am trying out the BindEvent now, but, may resort to using your code below. Will report back on my progress...
I'm sure BindEvent is great as many greats here suggest it, but I never got into it.
Regarding BindEvents()
Ted Roche stated several times "Events should always call methods." Until I started tracking down odd bugs with Timers and getting the "Is not an object" error with code in BindEvents I didn't fully understand why he said that. There are times an event will fire and the workspace the code thinks it should be in according to what you wrote isn't really there.
I like BindEvents(), however, I use the with a great deal of caution these days.
If at all possible subclass.
On could go to extremes by, subclass the Column and set the MemberClass and MemberClassLibrary on a grid for all the columns added to it to inherit from it. The Column class has HeaderClass and HeaderClassLibrary to do the same.
You may need this bit of help with the BindEvents, if you choose to go that route: lnEventCount = AEVENTS(arrEvent, 0) IF NOT VARTYPE(arrEvent(1)) = "O" RETURN ENDIF loHeader = arrEvent(1)
Tracy Pearson PowerChurch Software
I find subclassing an adequate alternative to function overloading <s>
On 02/02/2016 20:58, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
Honestly....without subclassing, I think I'd hate programming. It surely would not be as enjoyable.
<snip> >
[excessive quoting removed by server]
OK Mike - so, I downloaded your code - grdbase.prg - and was reviewing it. So, the SaveSource and RestoreSource exists in your PRG as Procs. Should I simply take each chunk of code, create New Methods in the Grid Subclass - and insert the code - then call SaveSource before a data refresh of the grid - and call RestoreSource after? What about the rest of the code in the PRG? Ignore it for now?? I suspect not, as I see your comments in the GrdBase class stating - "...used in SaveSource/RestoreSource". As such - I suspect I should be adding those Properties to my subclassed grid.
Thanks, -K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Tuesday, February 02, 2016 10:29 AM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
Honestly....without subclassing, I think I'd hate programming. It surely would not be as enjoyable.
Check out the SaveSource and RestoreSource methods I posted in the ProFox downloads section to add to your grid subclass. Those are MUST HAVEs in my opinion so you never have to rebuild your grids after changing (requerying) the underlying cursor.
hth, --Mike
On 2016-02-02 08:58, Kurt Wendt wrote:
Hey Mike - sorry I didn't see your reply till now.
At first I was hesitant to attempt to try and implement this particular solution - because it involved classes. I first tried to see if I could do it without doing the subclassing. But, then I saw that it required adding Methods and Properties to a Grid. I had done that with Forms - but, didn't know you couldn't do it with a Grid. So
- I took at stab at how to sub-class, just a pure guess - since there
were already a couple of visual classes in the project already - and was glad to see it was so easy to sub-class.
And - they say you Can't teach an Old Dog New Tricks. Well - this Dog just learned something new!
:-) -K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Saturday, January 30, 2016 6:32 PM To: profoxtech@leafe.com Subject: Re: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-01-29 17:20, Kurt Wendt wrote:
To be honest - I hadn't sub-classed before, but, I figured it out and made a Grid sub-class.
imo, subclassing is the BEST and will allow you to really love the Fox moreso. If I couldn't (or didn't) subclass, I might as well use VB. :-)
OOP is where's it at (still).
--Mike
[excessive quoting removed by server]
On 2016-02-03 09:07, Kurt Wendt wrote:
OK Mike - so, I downloaded your code - grdbase.prg - and was reviewing it. So, the SaveSource and RestoreSource exists in your PRG as Procs. Should I simply take each chunk of code, create New Methods in the Grid Subclass - and insert the code - then call SaveSource before a data refresh of the grid - and call RestoreSource after? What about the rest of the code in the PRG? Ignore it for now?? I suspect not, as I see your comments in the GrdBase class stating - "...used in SaveSource/RestoreSource". As such - I suspect I should be adding those Properties to my subclassed grid.
Correct. Add those 2 methods to your subclass and copy that code into them. Note that you'll need to create one or two custom properties referenced in that code as well. It's in the PRG like that because it was easiest to share the Class Browser output that way.
Thanks Mike for confirming the process as I noted.
Will let you know how it works out...
-K-
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Wednesday, February 03, 2016 12:10 PM To: profoxtech@leafe.com Subject: RE: Multi-Select Grid & Foxite Code Issue (Was...RE: A Question of ListBoxes)
On 2016-02-03 09:07, Kurt Wendt wrote:
OK Mike - so, I downloaded your code - grdbase.prg - and was reviewing it. So, the SaveSource and RestoreSource exists in your PRG as Procs. Should I simply take each chunk of code, create New Methods in the Grid Subclass - and insert the code - then call SaveSource before a data refresh of the grid - and call RestoreSource after? What about the rest of the code in the PRG? Ignore it for now?? I suspect not, as I see your comments in the GrdBase class stating - "...used in SaveSource/RestoreSource". As such - I suspect I should be adding those Properties to my subclassed grid.
Correct. Add those 2 methods to your subclass and copy that code into them. Note that you'll need to create one or two custom properties referenced in that code as well. It's in the PRG like that because it was easiest to share the Class Browser output that way.