Index
2009-03-26 13:25Vince Teachout : Re: Update field value
2009-03-26 14:22Jim Harvey : Update field value
2009-03-26 14:31Stephen Russell : Re: Update field value
2009-03-26 14:55MB Software Solutions General Account : Re: Update field value
2009-03-26 15:29Vince Teachout : Re: Update field value
2009-03-26 15:39Fred Taylor : Re: Update field value
2009-03-26 16:27MB Software Solutions General Account : Re: Update field value
2009-03-26 16:27MB Software Solutions General Account : Re: Update field value
2009-03-26 16:29Vince Teachout : Re: Update field value
2009-03-26 16:31Tracy Pearson : RE: Update field value
Back to top
Re: Update field value

Author: Vince Teachout

Posted: 2009-03-26 13:25:51   Link

Jim Harvey wrote:

> I'd like to update a field value by allowing the user to click a button that

> has a value as it's caption.

>

> There will be multiple buttons each with its own distinct value.

>

> I can put code in the click of each button knowing it's assigned value, and

> that will do the job, but would rather use a form method.

>

> Is there a way to have the method determine which button was clicked, and

> therefore assign the new value to the field.

>

> The code I'm using now in the button.click is:

>

> SELECT bidboard

>

> UPDATE bidboard SET amount = 6000

>

> llok = tableupdate(1,.f.,'bidboard')

>

> thisform.refresh

If I'm following you correctly, I would create a form method MyMethod

with a parameter. In the button click, I'd either call

Thisform.MyMethod(1) (Where the numeric is different for each button),

or better yet ThisForm.MyMethod(this.name) (allowing for exactly the

same code in each button)

Then in the method, use a CASE statement, and proceed from there.

©2009 Vince Teachout
Back to top
Update field value

Author: Jim Harvey

Posted: 2009-03-26 14:22:13   Link

I'd like to update a field value by allowing the user to click a button that

has a value as it's caption.

There will be multiple buttons each with its own distinct value.

I can put code in the click of each button knowing it's assigned value, and

that will do the job, but would rather use a form method.

Is there a way to have the method determine which button was clicked, and

therefore assign the new value to the field.

The code I'm using now in the button.click is:

SELECT bidboard

UPDATE bidboard SET amount = 6000

llok = tableupdate(1,.f.,'bidboard')

thisform.refresh

James E Harvey

Hanover Shoe Farms, Inc.

M.I.S./Corresponding Officer

Off: 717-637-8931

fax: 717-637-6766

email: jharvey@hanoverpa.com

©2009 Jim Harvey
Back to top
Re: Update field value

Author: Stephen Russell

Posted: 2009-03-26 14:31:45   Link

On Thu, Mar 26, 2009 at 1:22 PM, Jim Harvey <jharvey@hanoverpa.com> wrote:

> I'd like to update a field value by allowing the user to click a button that

> has a value as it's caption.

>

> There will be multiple buttons each with its own distinct value.

>

> I can put code in the click of each button knowing it's assigned value, and

> that will do the job, but would rather use a form method.

>

> Is there a way to have the method determine which button was clicked, and

> therefore assign the new value to the field.

>

> The code I'm using now in the button.click is:

>

> SELECT bidboard

>

> UPDATE bidboard SET amount = 6000

>

> llok = tableupdate(1,.f.,'bidboard')

>

> thisform.refresh

-----------------------------

just a guess here:

Click event for each button calls a single method with a param that

states the button.text

You can then use a CASE to separate the code that is unique to the button.

HTH

--

Stephen Russell

Sr. Production Systems Programmer

Web and Windows Development

Independent Contractor

Memphis TN

901.246-0159

©2009 Stephen Russell
Back to top
Re: Update field value

Author: MB Software Solutions General Account

Posted: 2009-03-26 14:55:28   Link

Vince Teachout wrote:

> Jim Harvey wrote:

>> I'd like to update a field value by allowing the user to click a button

that

>> has a value as it's caption.

>>

>> There will be multiple buttons each with its own distinct value.

>>

>> I can put code in the click of each button knowing it's assigned value,

and

>> that will do the job, but would rather use a form method.

>>

>> Is there a way to have the method determine which button was clicked, and

>> therefore assign the new value to the field.

>>

>> The code I'm using now in the button.click is:

>>

>> SELECT bidboard

>>

>> UPDATE bidboard SET amount = 6000

>>

>> llok = tableupdate(1,.f.,'bidboard')

>>

>> thisform.refresh

>

>

> If I'm following you correctly, I would create a form method MyMethod

> with a parameter. In the button click, I'd either call

> Thisform.MyMethod(1) (Where the numeric is different for each button),

> or better yet ThisForm.MyMethod(this.name) (allowing for exactly the

> same code in each button)

Vince -- you meant ThisForm.MyMethod(this) (...not just the name

attribute, but the actual object) right?

©2009 MB Software Solutions General Account
Back to top
Re: Update field value

Author: Vince Teachout

Posted: 2009-03-26 15:29:43   Link

MB Software Solutions General Account wrote:

> Vince -- you meant ThisForm.MyMethod(this) (...not just the name

> attribute, but the actual object) right?

No, in my example (again, assuming I understood the question) only a

property that can be tested by a CASE statement needs to be passed.

So if the Button name was ButtVal1, the click method

Thisform.MyMethod(this.name) would send the parm "ButtVal1" to the

method, and a CASE would then process for ( CASE lMyParm = "ButtVal1" )

©2009 Vince Teachout
Back to top
Re: Update field value

Author: Fred Taylor

Posted: 2009-03-26 15:39:03   Link

On Thu, Mar 26, 2009 at 12:29 PM, Vince Teachout <teachv@taconic.net> wrote:

> MB Software Solutions General Account wrote:

>

>

> > Vince -- you meant ThisForm.MyMethod(this) (...not just the name

> > attribute, but the actual object) right?

>

> No, in my example (again, assuming I understood the question) only a

> property that can be tested by a CASE statement needs to be passed.

>

> So if the Button name was ButtVal1, the click method

> Thisform.MyMethod(this.name) would send the parm "ButtVal1" to the

> method, and a CASE would then process for ( CASE lMyParm = "ButtVal1" )

>

>

>

>

>

>

>

> So why not pass "this"? You can then reference the button.Caption (or any

> other property) directly and not need any CASE statement.

>

>

> --

> Fred

>

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

©2009 Fred Taylor
Back to top
Re: Update field value

Author: MB Software Solutions General Account

Posted: 2009-03-26 16:27:12   Link

Vince Teachout wrote:

> No, in my example (again, assuming I understood the question) only a

> property that can be tested by a CASE statement needs to be passed.

>

> So if the Button name was ButtVal1, the click method

> Thisform.MyMethod(this.name) would send the parm "ButtVal1" to the

> method, and a CASE would then process for ( CASE lMyParm = "ButtVal1" )

Oh...I thought you meant that they were similar objects and hence had

the same interface, so referring to the common object was the way.

©2009 MB Software Solutions General Account
Back to top
Re: Update field value

Author: MB Software Solutions General Account

Posted: 2009-03-26 16:27:20   Link

Fred Taylor wrote:

>> So why not pass "this"? You can then reference the button.Caption (or any

>> other property) directly and not need any CASE statement.

>>

>>

>> --

>> Fred

My point exactly.

©2009 MB Software Solutions General Account
Back to top
Re: Update field value

Author: Vince Teachout

Posted: 2009-03-26 16:29:50   Link

Fred Taylor wrote:

> On Thu, Mar 26, 2009 at 12:29 PM, Vince Teachout <teachv@taconic.net> wrote:

>

>>

>> So why not pass "this"? You can then reference the button.Caption (or any

>> other property) directly and not need any CASE statement.

In this example, how does it eliminate the need for CASE?

Again, assuming I am understanding the problem correctly (ie, "change a

value, depending on which button I pressed."), what's the difference

between:

CASE myParam = "button1"

and

CASE oMyParam.Name = "button1"

?

©2009 Vince Teachout
Back to top
RE: Update field value

Author: Tracy Pearson

Posted: 2009-03-26 16:31:45   Link

Going back to the original request:

>> I'd like to update a field value by allowing the user to click a button

that has a value as it's caption.

Would result with:

UPDATE bidboard SET amount = val(oButton.Caption)

-----Original Message-----

From: Vince Teachout

Sent: Thursday, March 26, 2009 4:30 PM

Fred Taylor wrote:

> On Thu, Mar 26, 2009 at 12:29 PM, Vince Teachout <teachv@taconic.net>

wrote:

>

>>

>> So why not pass "this"? You can then reference the button.Caption

>> (or any other property) directly and not need any CASE statement.

In this example, how does it eliminate the need for CASE?

Again, assuming I am understanding the problem correctly (ie, "change a

value, depending on which button I pressed."), what's the difference

between:

CASE myParam = "button1"

and

CASE oMyParam.Name = "button1"

?

©2009 Tracy Pearson