Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 29, 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 - Controls
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Controls | New ThreadView:  Search:  
 Author  Thread: locking down a TComboBox dropdown
Glenn Williams
Posts: 51
 
locking down a TComboBox dropdownYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Dec 08 7:31 AM
How do you prevent users from using/typing anything other than what's in the drop down list? Here's why and what I've done so far:

- Set key=0 in the the keypress control. Prevents typing, but users can still paste into the box with ctrl-v or rt-clk mouse paste. Sneeky 'eh?
- I would use a picklist, but I change the contents of the dropdown based on the type of user logged in.
- Can I / should I create 4 picklists and dynamically change the picklist?

Am I overlooking something simple here? Thanks a bunch.
v7.2.2:
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: locking down a TComboBox dropdownYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Dec 08 9:58 AM
No you are not overlooking something simple....you have to script against it....learned this from SLX Opportunity:SALESPROCESS form.....

0. Set the OnKeyPress event of the combo box.....Key = 0

1A. use the ONDROPDOWN event of the Combo Box for your 'change' action.

1B. for the OnChange I just post a nice MSGBOX and tell them to click on the Drop Down Button and then I close up the view.....too much going on in my form to figure out how to rebuild the combo box on the fly.....your mileage will vary.

2. Set an IsReading variable in the AXFormChange/Opening (I also use a Global Pointer to the ItemINDEX value)

Option Explicit
DIM IsReading, gNextPhaseIDX

SUB AXFormChange(Sender)
''handles databinding OnChange versus User Changes
IsReading = true
gNextPhaseIDX = -1
''''do stuff, including building up the Combo Box and setting its initial Index ( gNextPhaseIDX in this example)!
IsReading = False
END SUB

3. Here is the ONDROPDOWN event call

Sub cbNextPhasesONDROPDOWN(Sender)
DIM I, ITEMP
ITEMP = -100
For i = 0 To SENDER.Items.Count - 1
If SENDER.TEXT = SENDER.Items.Item(i) Then
gNextPhaseIDX = i
iTemp = i
Exit For
End If
NEXT
IF ITEMP < 0 THEN
MSGBOX " Do us all a favor and simply select an item from the drop down list"
reset the index to 1, gNextPhaseIDX or whatever
UNFORTUNATELY YOU MUST rebuild the combo box
exit the sub
END IF

I did post this on the WISHLIST for SLX.....this has been requested multiple times in the past....

RJ
[Reply][Quote]
Glenn Williams
Posts: 51
 
Re: locking down a TComboBox dropdownYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Dec 08 1:01 PM
RJ,

It works perfectly, Thanks very much for your time and support.

Glenn
[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/29/2024 9:48:50 PM