Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: How to change the OK button behaviour
william xie
Posts: 28
 
How to change the OK button behaviourYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Sep 06 11:47 PM
fiogf49gjkf0d
When we click the OK button in the data form, it will save the data and hide the form.

Can I make it still in the original form after click the OK button?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: How to change the OK button behaviourYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Sep 06 2:18 AM
fiogf49gjkf0d
Change the button's "ModalResult" property to mrNone (or the Kind property to bkCustom). This will make it so that your own code can run behind the click on the button instead of closing and passing back result to the caller. Then in the code behind the button do whatever you need to do, then call:

ModalResult = mrOK

' -or-

ModalResult = mrCancel


This will close the form and save any bound values (if you use mrOK).
[Reply][Quote]
william xie
Posts: 28
 
Re: How to change the OK button behaviourYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Sep 06 2:42 PM
fiogf49gjkf0d
In my source code, I fist set the "Modal Result" property of OK button : mrNone, then in script:

if validInput = True Then
Sender.ModalResult = mrOK
else
Sender.ModalResult = mrNone
end if

The problem is I must click twice, then it can Save and close the form. Any idea?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: How to change the OK button behaviourYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Sep 06 6:22 PM
fiogf49gjkf0d
You're setting the ModalResult of Sender (which I assume is your button). You actually want to set the ModalResult of the Form itself. Get rid of the Sender from your code you posted and all should work fine (or replace "Sender" with your form name)
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: How to change the OK button behaviourYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Sep 06 6:34 PM
fiogf49gjkf0d
To explain my last answer a bit more. The form's ModalResult property will cause the form to close and post and bound values to the database. When you set the ModalResult of a button, that is what it will set the form's ModaleResult when clicked. The button's ModalResult in itself means nothing, it is only used to set the form's ModalResult (when clicked). The Form's ModalResult property is the one that matters.

So the reason why you're form needs two clicks to close is because the first time you set the button's ModalResult property which has no effect until clicked again. If you just set the Form's ModalResult property it will happen right then, closing the form and saving the values.

make sense?
[Reply][Quote]
william xie
Posts: 28
 
Re: How to change the OK button behaviourYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Sep 06 9:04 AM
fiogf49gjkf0d
I got it. Thanks Ryan!
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/26/2024 3:38:01 PM