Alpha Video Training
Results 1 to 12 of 12

Thread: Ok in Change mode but not Enter

  1. #1
    Member
    Real Name
    Robert Picard
    Join Date
    Apr 2000
    Posts
    326

    Default Ok in Change mode but not Enter

    Hi

    I don't understand why this paticular script works ok in Change mode but not Enter mode.

    f = parentform.this
    if F.restrict_enter=.F. .or. F.restrict_change=.f. then
    dis = "Y"
    else
    dis = "V"
    end if
    f:Cond10.refresh()

    I have set my form to mimic A4 in terms of change and enter i.e. not modeless. A field has this script attached to the ONARRIVE event. It will turn the conditional object on and off base on the two variables in Change mode but not enter mode.

    What am I missing. I know..something obvious, but what else is new.

    Thank you

    Robert

  2. #2
    Former Alpha Employee JerryBrightbill's Avatar
    Real Name
    Jerry Brightbill
    Join Date
    Apr 2000
    Posts
    5,172

    Default RE: Ok in Change mode but not Enter

    Why not use mode_get() instead of "F.restrict_enter=.F. .or. F.restrict_change=.f."? In enter mode, parentform.mode_get() = ENTER. In change mode, parentform.mode_get() = CHANGE.

    Jerry

  3. #3
    Member
    Real Name
    Robert Picard
    Join Date
    Apr 2000
    Posts
    326

    Default RE: Ok in Change mode but not Enter

    Hi Jerry

    Either way the script fragment does not execute in Enter mode. The conditional object does not display properly. I don't know if the variable is not being set or whether the refresh is not executing or both. As I said the change mode is ok but enter is not.

    Do change and enter execute scripts differently.

    Robert

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Ok in Change mode but not Enter

    Robert,

    maybe you have a flaw in the internal logic of the script?

    the 'if' statement will fire in all cases until both restrict_change and restrict_enter are true... that's the only the time the 'else' statement will be run

    what are you expecting?

    what are the antecedent property values for restrict_change and restrict_enter, when the form is opened?

    under what circumstances do these properties get changed?

  5. #5
    Former Alpha Employee JerryBrightbill's Avatar
    Real Name
    Jerry Brightbill
    Join Date
    Apr 2000
    Posts
    5,172

    Default RE: Ok in Change mode but not Enter

    Robert,
    I did a little experimenting and indeed a conditional object does not work correctly in enter mode. I created a very different code using mode_get() and it worked every time for change mode. In enter mode, the variable value changes and is correct, but the conditional does not work. Do you need a conditional object? If you are using it to show information, you can use a text field and change the text displayed.

    if dis = "Y"
    parentform:text1.text = "Change mode"
    elseif dis = "X"
    parentform:text1.text = "Enter mode"
    else
    parentform:text1.text = ""
    end
    parentform:text1.refresh()

    This seems to work reliably. If you are using the conditional to show or hide other fields, you can use the hide() and show() properties to display the fields you want.

    I normally don't use conditionals since earlier experience with them was frustrating. I have made them work based on the value of a field object, but I find other methods more suited to me.

    Jerry

  6. #6
    Member
    Real Name
    Robert Picard
    Join Date
    Apr 2000
    Posts
    326

    Default RE: Ok in Change mode but not Enter

    Thank you Tom & Jerry...love your cartoons:)

    I use a conditional object because there are three different items to be displayed depending on the variable value. I will have to rethink this.

    At least now know I had it right in terms of coding and its A5 throughing me a curve. Have you noticed that A5 isn't always consistent in handling events under certain conditions. This can be frustrating and time consuming when you think your the problem and its A5.

    Don't get me wrong I thing A5 is a great product.

    Thanks everyone for your responses. I encourage anyone to contribute to this board. You may feel that you are not knowlegable enough and your suggestions obvious...but something you say or suggest could start us thinking in a new direction about our problems.

    Robert

  7. #7
    Former Alpha Employee JerryBrightbill's Avatar
    Real Name
    Jerry Brightbill
    Join Date
    Apr 2000
    Posts
    5,172

    Default RE: Ok in Change mode but not Enter

    Doing the toons was fun, but the residuals aren't much.

    Actually if you only have three fields to hide or show you shouldn't have any problems. You can even overlay the fields and have some default to hidden on startup. (Makes form design interesting) I have a form with many more fields to hide and show that has a script on the OnFetch event. This has lead to "Maximum Stack Depth" errors when fetching quickly. A workaround was found by myself and others and listed in the readme documentation for the 4.03 update.

    Good luck on the redesign. One of the neat things about Alpha is that there are frequently a number of different ways to get the same result. But like any program, it isn't perfect. At least with the help of this forum, a solution can usually be found.

    Jerry

  8. #8
    Member
    Real Name
    Robert Picard
    Join Date
    Apr 2000
    Posts
    326

    Default RE: Ok in Change mode but not Enter

    Thanks Jerry

    Robert

  9. #9
    Tom Scholis
    Guest

    Default RE: Ok in Change mode but not Enter

    Robert, I've had similar problems and when all else fails I do the following... If the variables are changing correctly, which they appear to be according to Jerry's post of 05-18-2001 08:20. The problem may be that the refresh just isn't working! Maybe it's a memory problem (it doesn't really matter)?

    To fix this, you might try placing an invisible button on the conditional object (you may have to enlarge the conditional or make a very small button. Place the refresh code in the invisible button; in place of the refresh code at the end of the original script. Place a buttonX.push()where "X" refers to the invisible button object. Work-arounds-are-us.

  10. #10
    Tom Scholis
    Guest

    Default RE: Ok in Change mode but not Enter

    The next to last sentence of my last post may be a little unclear, what I meant to suggest was that you need to place the buttonX.push() code at the end of the original script in place of the original refresh code. Also, you might try a less object specific refresh, if speed isn't a problem. I hope this helps.

  11. #11
    Former Alpha Employee JerryBrightbill's Avatar
    Real Name
    Jerry Brightbill
    Join Date
    Apr 2000
    Posts
    5,172

    Default RE: Ok in Change mode but not Enter

    Tom,
    Unfortunately, in my test I tried a refresh() and that didn't work. Personally, I just don't care for the way conditionals work. But your test idea is one I use frequently. If I am unsure about how an event or code is working, I will put it on a temporary button. Then I can push it manually or with the push() command and see what is happening. I also use trace.writeln() frequently in scripts to sent information to the trace windows. I have found some interesting surprises about how expressions are evaluating or which event fires first.

    Jerry

  12. #12
    Member
    Real Name
    Robert Picard
    Join Date
    Apr 2000
    Posts
    326

    Default RE: Ok in Change mode but not Enter

    Hi Tom

    I need the event to fire when it enters a field.

    The conditional object diplays a list of different HOTKEYS available to the user depending on the mode they are in and the active field.

    Thanks for the tip though. It could be handy.

    Robert

Similar Threads

  1. change table in enter mode
    By aau Ching in forum Alpha Five Version 5
    Replies: 4
    Last Post: 12-05-2003, 02:48 PM
  2. Table not in change or enter mode
    By Martin in forum Alpha Five Version 4
    Replies: 1
    Last Post: 06-12-2002, 12:39 PM
  3. Change / Enter Mode BUG!!??
    By forskare in forum Alpha Five Version 4
    Replies: 0
    Last Post: 09-15-2000, 06:38 AM
  4. Enter or Change Mode
    By forskare in forum Alpha Five Version 4
    Replies: 5
    Last Post: 09-13-2000, 06:43 PM
  5. table not in change or enter mode
    By Lloyd Frank in forum Alpha Five Version 4
    Replies: 15
    Last Post: 06-30-2000, 05:33 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •