gsprague Posted October 12, 2004 Posted October 12, 2004 I have 2 pop-up menus with that are non-enterable in browse mode. Is there a sciprting function I can use to turn these to enterable after the user clicks a button. Basically want to be able to set Field Behavior:Allow user to enter:in browse mode = true. Is this possible? Thanks, -G
transpower Posted October 12, 2004 Posted October 12, 2004 Have two layouts, one which allows entry, one which does not.
gsprague Posted October 12, 2004 Author Posted October 12, 2004 So just duplicate the layout and when they click the button it will Go To the other layout for entry?
MoonShadow Posted October 13, 2004 Posted October 13, 2004 I wouldn't create another layout just because of this need. If you change one layout, you'll always be having to change the 'shadow' layout also. And, so Users can't tell you have switched them, you must make sure that if you move something on one layout you duplicate precisely the move on the other layout also. It's a pain in the neck. You might instead consider: Create a global number field (gToggle) and attach a script-step to it of: Set Field [ gToggle; Abs(gToggle) < 1 ] Then attach following script to popup1: If [gToggle] or Get(WindowMode) Go To Field [popup1] End If Repeat with your second popup. Click toggle, both popups can be entered in Browse even if Field Behavior is set to not allow entry. Click button again and they can't be entered. But they can be entered in Find Mode whether the toggle is on or off. And it will apply to all records until the toggle is again clicked off. You can get fancy and place a text calculation (set to not allow entry) on top of the toggle button showing the state of popup entry, such as: If(gToggle; "On"; "Off") This same toggle can be used in Access Privileges if you wish; or the toggle button can be on another layout, or restricted on who can toggle it and it can even be based upon other calculations or field conditions. If you want the toggle to only apply to one specific record, instead of releasing popups for all records for that User session, use a standard number field instead of a global for the toggle.
gsprague Posted October 13, 2004 Author Posted October 13, 2004 Thank you MoonShadow!! I have already run into the problem of the menus not lining up...kinda frustrating. I will try your method. Seems like it may take me a while to figure out though. I'll get back to you.
MoonShadow Posted October 13, 2004 Posted October 13, 2004 I just noticed you are Mac. Popup menus may not perform the same when scripts are attached for your OS. You may want to consider a popup list instead if you run into problems, ie, the popup menu won't stay open, etc. I've never used Mac.
gsprague Posted October 13, 2004 Author Posted October 13, 2004 I do I attach a script-step to my global field. Do I make the field a calculation and add the script in there?
gsprague Posted October 13, 2004 Author Posted October 13, 2004 English helps huh. I meant; How do I attach a script-step to my global field?
gsprague Posted October 13, 2004 Author Posted October 13, 2004 This isn't gonna work; I don't even know how to attach a script-step to my global field. Thanks though.
MoonShadow Posted October 14, 2004 Posted October 14, 2004 This isn't gonna work; I don't even know how to attach a script-step to my global field. Don't let it discourage you, we'll get through it. You don't attach the script directly to the global field, sorry I wasn't clear enough. When I said 'attach a script-step to it' I mean the button. You attach the gToggle script to the button itself which (behind the scenes) sets your gToggle global field. I can provide a simple demo file if you wish - just say the word. Once you see it in action, it'll all become clear for you.
gsprague Posted October 14, 2004 Author Posted October 14, 2004 OK, I setup the button as follows: Set Field [ Global::_gToggle; Abs(Global::_gToggle) < 1 ] How do I set a script to my pop-up menu. Would I have to do that on the layout load from the previous layout or put it in the auto-enter calculation maybe? Thanks for all your help!
MoonShadow Posted October 14, 2004 Posted October 14, 2004 You just attach the popup script directly to the popup. Right-Click and select Specify Button and Perform Script > attach your popup script there. And be sure Field Behavior on the popups don't allow entry. That will happen (and be allowed) when the User clicks the popup. Your script will take over and let them in if 1) Your button toggle is set to 1 or 2) They are in Find Mode when they try to pop it.
gsprague Posted October 14, 2004 Author Posted October 14, 2004 Ah I see know. I still cannot get it to work but that is OK. I went with the duplicate layout instead because I actually don't want the pop-up menus to even be seen. Cause if click on the pop-up menu without entry allow selected you still get an error dialog stating that there are no records available. So I think the duplicate layout is what I want unless there is a function to hide pop-up menus? Thanks a mil!
gsprague Posted October 15, 2004 Author Posted October 15, 2004 I'm actually going to try doing this. I was told that you can hide and show pop-up menus within a Portal. I will try this and let you know how it ends up. Please anyone let me know if you have any ideas for this. Thanks!
MoonShadow Posted October 15, 2004 Posted October 15, 2004 Cause if click on the pop-up menu without entry allow selected you still get an error dialog stating that there are no records available. You mean when you are finding? You need Set Error Capture [On] and include a script-step to handle it, if no records are found. The process I outlined for that popup does indeed work so if it isn't working, something else must be going on. You indicate the global with :: ... what kind of relationship are you working with? You didn't say what doesn't work!? Yes, you can use invisibility to hide the popup - but how will Users use it if you hide it and how will a duplicate layout solve this problem for you? I'm afraid, unless you explain more, we can't help you with any specifics. Please remember that we can't see your solution and only know what you specifically tell us. But that's okay, as it seems you've now changed what you want to do anyway?
gsprague Posted October 18, 2004 Author Posted October 18, 2004 Basically I am setting up conditional pop-up menus. And I want each menu to appear or hide depending upon what was selected in the previous pop-up menu. This GUI I am building is having to do with Applications. you can select applications to asign to a client. You would first select the Application name from a pop-up menu. Then the version pop-up menu only shows the verions of the application that you have selected in association to my applications database. Next you choose a serial number, and this also lets you know how many seats are left per serial number. If the serial number is an upgrade I want an upgrade version, serial number, seats, seats left, current serial number and version pop-up menus to appear. So now the user can select a serial to upgrade from. If the serial number select is new then the client will not see the upgrade pop-up menus. Everything is working but currently I am going to another layout with the added upgrade menus. I just want to be able to hide or show the upgrade menus in browse mode. Supposedly you can do it with a portal? Please let me know if you need more details or have any questions. Thank you!
-Queue- Posted October 18, 2004 Posted October 18, 2004 Yes, you can do it with a portal. You want a calculation field of Case( {serial = upgrade}; serial ), where {serial = upgrade} is whatever test you are using to determine when it's an upgrade. Create a relationship from this calculation to the serial field. Then put a portal on your layout using this relationship and put the menu fields inside it.
gsprague Posted October 19, 2004 Author Posted October 19, 2004 Do you know if there a tutorial for this?
-Queue- Posted October 19, 2004 Posted October 19, 2004 There are sample files on databasepros.com. But I am unaware of any tutorials on the technique. I have learned it through trial and error.
gsprague Posted October 19, 2004 Author Posted October 19, 2004 Would you be able to send me an example?
-Queue- Posted October 19, 2004 Posted October 19, 2004 Do a search in the Resources section on www.databasepros.com for 'visibility'.
gsprague Posted October 19, 2004 Author Posted October 19, 2004 Thank you for the reference. I've been working with these files for 2 hours and getting no where. I must be an idiot.
-Queue- Posted October 19, 2004 Posted October 19, 2004 It isn't the easiest of techniques to get one's head around. So don't beat yourself up about it. With which parts are you having difficulty?
gsprague Posted October 20, 2004 Author Posted October 20, 2004 I guess with the global toggle variable? Do my menus have to be in a portal for this to work?
gsprague Posted October 20, 2004 Author Posted October 20, 2004 I have looked at these examples for another 2 hours this morning. They still do not make any sense to me. I cannot find any relations between the buttons and what is being hidden or shown. The only thing I can find is the calculation ::=constant relation. And that is not even tied to the any of the buttons which preform the script or any of the fields that are being hidden or shown. So the whole thing is a confusion because I don't know where to begin. I even bought a $45 book and that has no examples either...argh!! All I want is to be able to hide or show a pop-up menu based on another pop-up menus results.
gsprague Posted October 20, 2004 Author Posted October 20, 2004 So far I have setup: Field = _gUpgrade Type = Text Options = Global, w Auto-Enter Calc Field = _gCondCal Type = calculation calculation = Unstored, from Global, = Case ( _gUpgrade="upgrade" ; IsEmpty ( _gVersionUpgradeFrom ); ""; 1) I'm not really sure what to put for a result?? I have also made a relation between these 2. In my layout I have a portal set to this relation. I have 5 pop-up menus with this portal. Application, Version, Serial, Upgrade, VersionToUpgradeFrom. Based on the Upgrade pop-up menu I want the VersionToUpgradeFrom pop-up menu to hide or show: If Upgrade pop-up menu contains "upgrade" then show VersionToUpgradeFrom pop-up menu else hide VersionToUpgradeFrom pop-up menu end if Do i need to attach anything to these pop-up menus or do I only need the realtion set in the portal? Thank you! Galen
-Queue- Posted October 20, 2004 Posted October 20, 2004 I wouldn't use the constant result version. It can take long awhile to calculate when there are hundreds to thousands of records. I would use the serial result, as stated earlier. Make your non-global calc Case( _gUpgrade = "upgrade" and not IsEmpty(_gVersionUpgradeFrom); serial ) and relate this to the serial for each record. You definitely don't want it to be global or it will show the same result for all records until you modify one. Put a portal on your layout that displays one related record, using this relationship . Anything you put in the portal will only display when the relationship is valid (your calculation returns the serial).
gsprague Posted October 20, 2004 Author Posted October 20, 2004 Do i want to store my calculation in my Global database and relate to my global serial?
-Queue- Posted October 20, 2004 Posted October 20, 2004 Neither the calculation nor the serial should be global. You want it to recalculate and be unique to each record. The calculation cannot be stored because it references globals.
gsprague Posted October 21, 2004 Author Posted October 21, 2004 I finally figured this out. I made a calculation in my global table but not a global variable of: _gupgrade = "upgrade" And another indexed calculation in my global table but not a global variable of: 1 Both of these calculations reside in my Global Table but they are not global fields. Only reference Global variables. Then I made a relation from the calculation to the indexed calc and set the portal to this, added my menus, and created a new record. And it worked!!! Thank you for all your help Queue!!
Jeep Watson Posted October 23, 2004 Posted October 23, 2004 Sounds like an interesting technique. Would you consider posting the file so I could examine what you did?
Recommended Posts
This topic is 7697 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now