I'm probably missing something obvious here or being thickheaded about this, but here's my situation:
I have a standard lookup button class I use all the time that I drop onto a form, set several properties, do a simple query to create a picklist and then it uses CREATEOBJECT to create a simple form from my class library, then it uses ADDOBJECT to add a Grid from the class library and Select/Cancel buttons to the form. After creating the grid, I loop through the fields in the picklist and setup the columns in the grid. I use BINDEVENT to provide the functionality to the click event of each button and the dblclick event of the grid columns. This class has worked perfectly for many years and is easy to use and include whenever I want a simple look up for a single selection from the picklist by the user.
However, today I was trying to add some functionality to the class by adding a checkbox in the first column of the grid to allow users to make multiple selections from the picklist. Adding a 'Sel' field to the query and setting the resulting cursor to READWRITE was easy enough. Displaying the checkbox in the generated grid was also easy. I set the readonly propery for the grid, the column and the checkbox to .f. and everything displays correctly but no matter what I do, when I click on the checkbox, nothing happens.
I've confirmed the cursor is readwrite at runtime. I've monitored readonly properties all the way to the moment the .show() method is called to display the picklist form and they all are .f. until after the .show() method executes. I've traced the code for all the parent elements and can find no other place where any readonly properties are being set to .t.
My question is this: If I'm using ADDOBJECTS and BINDEVENT commands to create this picklist form, do I need to create a procedure specifically for the CLICK event of the checkbox to issue a DODEFAULT() command and then bind that to the Click Event manually or will the checkbox just automatically use the base CLICK event code from the parent class?
I haven't worked with ADDOBJECTS and BINDEVENT commands often (the last time was probably when I wrote the original code for the picklist class I'm trying to modify) and I'm not sure this makes sense, but after a couple of hours failure, I decided to give up and ask for help.
Thanks in advance!
Paul H. Tarver
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Paul, since you're adding the control at run time, did you set the checkbox visibility to .T.?
On Sat, Apr 25, 2020 at 8:31 PM Paul H. Tarver paul@tpcqpc.com wrote:
I'm probably missing something obvious here or being thickheaded about this, but here's my situation:
I have a standard lookup button class I use all the time that I drop onto a form, set several properties, do a simple query to create a picklist and then it uses CREATEOBJECT to create a simple form from my class library, then it uses ADDOBJECT to add a Grid from the class library and Select/Cancel buttons to the form. After creating the grid, I loop through the fields in the picklist and setup the columns in the grid. I use BINDEVENT to provide the functionality to the click event of each button and the dblclick event of the grid columns. This class has worked perfectly for many years and is easy to use and include whenever I want a simple look up for a single selection from the picklist by the user.
However, today I was trying to add some functionality to the class by adding a checkbox in the first column of the grid to allow users to make multiple selections from the picklist. Adding a 'Sel' field to the query and setting the resulting cursor to READWRITE was easy enough. Displaying the checkbox in the generated grid was also easy. I set the readonly propery for the grid, the column and the checkbox to .f. and everything displays correctly but no matter what I do, when I click on the checkbox, nothing happens.
I've confirmed the cursor is readwrite at runtime. I've monitored readonly properties all the way to the moment the .show() method is called to display the picklist form and they all are .f. until after the .show() method executes. I've traced the code for all the parent elements and can find no other place where any readonly properties are being set to .t.
My question is this: If I'm using ADDOBJECTS and BINDEVENT commands to create this picklist form, do I need to create a procedure specifically for the CLICK event of the checkbox to issue a DODEFAULT() command and then bind that to the Click Event manually or will the checkbox just automatically use the base CLICK event code from the parent class?
I haven't worked with ADDOBJECTS and BINDEVENT commands often (the last time was probably when I wrote the original code for the picklist class I'm trying to modify) and I'm not sure this makes sense, but after a couple of hours failure, I decided to give up and ask for help.
Thanks in advance!
Paul H. Tarver
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
Antonio,
I responded previously but I didn't see the reply come through and it didn't show up in the archive. However, I'm very happy it didn't because in my reply I confirmed I had set the checkbox visibility to true. And, I knew it was true because I could clearly see the checkbox in the grid when it was displayed. But as you well know, when you "assume" ANYTHING, it will bite you in the end.
After toying some more this morning with the BINDEVENT command for the checkbox, I noticed for all other field types in my code, the Visibility of the control was set to .t.. Your reply clicked when I realized I hadn't explicitly included that setting for the checkbox. What I was seeing on the screen was the underlying column display value NOT the actual checkbox control itself. I could have clicked until I was blue in the face and nothing would ever happen because the actual control was hidden.
Long story short, I set the Visibility = .T. and all of the default functionality I wanted, started working perfectly.
Thanks for the help on this issue. Once again, my problem is caused more by me than by Foxpro. :)
Paul H. Tarver
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of António Tavares Lopes Sent: Sunday, April 26, 2020 6:14 AM To: profoxtech@leafe.com Subject: Re: AddObject/BindEvent Question
Paul, since you're adding the control at run time, did you set the checkbox visibility to .T.?
On Sat, Apr 25, 2020 at 8:31 PM Paul H. Tarver paul@tpcqpc.com wrote:
I'm probably missing something obvious here or being thickheaded about this, but here's my situation:
I have a standard lookup button class I use all the time that I drop onto
a
form, set several properties, do a simple query to create a picklist and then it uses CREATEOBJECT to create a simple form from my class library, then it uses ADDOBJECT to add a Grid from the class library and Select/Cancel buttons to the form. After creating the grid, I loop through the fields in the picklist and setup the columns in the grid. I use BINDEVENT to provide the functionality to the click event of each button and the dblclick event of the grid columns. This class has worked perfectly for many years and is easy to use and include whenever I want a simple look up for a single selection from the picklist by the user.
However, today I was trying to add some functionality to the class by adding a checkbox in the first column of the grid to allow users to make multiple selections from the picklist. Adding a 'Sel' field to the query and
setting
the resulting cursor to READWRITE was easy enough. Displaying the checkbox in the generated grid was also easy. I set the readonly propery for the grid, the column and the checkbox to .f. and everything displays correctly but no matter what I do, when I click on the checkbox, nothing happens.
I've confirmed the cursor is readwrite at runtime. I've monitored readonly properties all the way to the moment the .show() method is called to display the picklist form and they all are .f. until after the .show() method executes. I've traced the code for all the parent elements and can find no other place where any readonly properties are being set to .t.
My question is this: If I'm using ADDOBJECTS and BINDEVENT commands to create this picklist form, do I need to create a procedure specifically
for
the CLICK event of the checkbox to issue a DODEFAULT() command and then bind that to the Click Event manually or will the checkbox just automatically use the base CLICK event code from the parent class?
I haven't worked with ADDOBJECTS and BINDEVENT commands often (the last time was probably when I wrote the original code for the picklist class I'm trying to modify) and I'm not sure this makes sense, but after a couple of hours failure, I decided to give up and ask for help.
Thanks in advance!
Paul H. Tarver
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]