stefangs Posted January 2, 2010 Posted January 2, 2010 top of the year to everyone! i have formatted my checkboxes as a button so that the cursor does not visibly enter the field. each time i click on the box, the status is supposed to toggle just as it normally does (with its ugly framed look i want to avoid). i pass the field name or object name as a script parameter to enter the correct field. with the debugger i can see that the correct field is entered, but when the script gets to the "Set Field" part (the actual field name is not specified, only the value), nothing happens. why is that and how can i get around it? btw, the same field formatted as an edit box works.
Lee Smith Posted January 2, 2010 Posted January 2, 2010 You can turn off the Frames. Layout Mode>> Layout >> Layout Setup >> (deselect) Show field frames when record is active.
stefangs Posted January 2, 2010 Author Posted January 2, 2010 (edited) hi, please find attached a demo. - sorry don't know how to remove a demo file. the lower one is the correct one. Checkbox.zip Checkbox.zip Edited January 3, 2010 by Guest
stefangs Posted January 2, 2010 Author Posted January 2, 2010 hmmm... that does not work, because while the frame is not visible when you're on another field, it is still visible when you enter the field with the check box or radio button.
comment Posted January 3, 2010 Posted January 3, 2010 The scripts seem to be working in the attached file. --- BTW, I am puzzled why don't you use Set Field By Name[], seeing that you are using v.10.
stefangs Posted January 3, 2010 Author Posted January 3, 2010 yes, it works, but only because i used the field name as a literal. i want to parse the field name as a script parm so i can reuse the script for similar uses.
stefangs Posted January 3, 2010 Author Posted January 3, 2010 ooh, i never found set field by name. i think that may be the ticket. let me try. i'll come back.
comment Posted January 3, 2010 Posted January 3, 2010 yes, it works, but only because i used the field name as a literal. But how can we see why it doesn't work, when it does? BTW, I would do it this way: Toggle10.fp7.zip
stefangs Posted January 3, 2010 Author Posted January 3, 2010 But how can we see why it doesn't work, when it does? that's a good point. i uploaded a 'fixed' i.e. broken version. BTW, I would do it this way: how nice! how come the webdings always display a check, no matter what value is displayed. is that a safe x-platform option? don't know if windows have them too. Checkbox_03.zip
comment Posted January 3, 2010 Posted January 3, 2010 how come the webdings always display a check, no matter what value is displayed. Format > Number… > Format as Boolean. is that a safe x-platform option? I believe so. i uploaded a 'fixed' i.e. broken version. Here's a 'broken' i.e. fixed one: Checkbox.fp7.zip
stefangs Posted January 3, 2010 Author Posted January 3, 2010 ah yes, i forgot about that. great! thanks for 'breaking' it. god, i hate it when i don't fully understand such a deceptively simple one-liner. but i've been through phases like this many times. eventually i'll get it! thanks so much for your help!
comment Posted January 3, 2010 Posted January 3, 2010 Would it be easier to understand if I wrote: If [ Get ( ActiveFieldContents ) > 0 ] Set Field [""] Else Set Field [1] End If
stefangs Posted January 4, 2010 Author Posted January 4, 2010 Would it be easier to understand if I wrote: If [ Get ( ActiveFieldContents ) > 0 ] Set Field [""] Else Set Field [1] End If ah yes, that's more like my level of programming! this approach is actually what i've been poking around with all the time. i was able to shorten the if/then with this: SetField (not datafield) thanks again! i hope to step up to the more elegant way in 2010 -)
comment Posted January 4, 2010 Posted January 4, 2010 Well, since you're going to set the field anyway, then obviously the If comes too soon and makes the script unnecessarily verbose. There's enough time to make the decision when setting the field - by calculation. The difference between: not Field and: Choose ( Field ; 1 ) is that the former toggles between 0 and 1, while the latter toggles between 1 and empty.
stefangs Posted January 4, 2010 Author Posted January 4, 2010 the former toggles between 0 and 1, while the latter toggles between 1 and empty. which is even better because it's more in line of what a check box does, i.e. putting nothing in the field rather something else.
comment Posted January 4, 2010 Posted January 4, 2010 Sometimes it's better, and sometimes I'll have the field auto-enter 0 when the checkbox is deselected - because you cannot base a relationship on an empty field.
stefangs Posted January 4, 2010 Author Posted January 4, 2010 one more thing, then i believe i'm done with this. when clicking on the check box, can i trap the actual field name and pass that as a script parameter? or do i need to give object names to all the check box fields?
stefangs Posted January 4, 2010 Author Posted January 4, 2010 in my case, this does not matter, but good to keep in mind anyway. avoids a new topic down the line!
comment Posted January 4, 2010 Posted January 4, 2010 when clicking on the check box, can i trap the actual field name and pass that as a script parameter? or do i need to give object names to all the check box fields? I am not sure which of the two methods you are referring to. In any case, if the field is a button it does not become active by clicking on it - so you cannot "trap" it. But you can place the actual field name in the parameter without going through object.
stefangs Posted January 5, 2010 Author Posted January 5, 2010 stefangs Said: when clicking on the check box, can i trap the actual field name and pass that as a script parameter? or do i need to give object names to all the check box fields? I am not sure which of the two methods you are referring to. In any case, if the field is a button it does not become active by clicking on it - so you cannot "trap" it. But you can place the actual field name in the parameter without going through object. sorry - i can't read our last few posts anymore. the list always cuts off. i did get them via email though. anyway, i tried using the field name (which brings us back to the original title of the topic), but i can't say Go To Field using a script paramater and saying Set Field By Name (Get (ScriptParameter)), 1) doesn't work for some reason.
comment Posted January 5, 2010 Posted January 5, 2010 i can't say Go To Field using a script paramater Yes, that's true - that's why I suggested using Set Field by Name[], which doesn't require activating the field at all. Set Field By Name (Get (ScriptParameter)), 1) doesn't work for some reason. It works in my (first) file, does it not? Make sure the script parameter is the field's name, not the object name.
stefangs Posted January 5, 2010 Author Posted January 5, 2010 Quote: i can't say Go To Field using a script paramater Yes, that's true - that's why I suggested using Set Field by Name[], which doesn't require activating the field at all. Quote: Set Field By Name (Get (ScriptParameter)), 1) doesn't work for some reason. It works in my (first) file, does it not? Make sure the script parameter is the field's name, not the object name. sorry to keep replying to the wrong entry, but i still can't see the last few replies. so yes, it does work now. i went back to your file and saw that you put "GetFieldName ( Tablename::Fieldname )". i just put the fieldname and i guess that's not good enough. so looks like i'm all set now. i also get the 'one-liner' now from your first post. thanks for all the input!
comment Posted January 5, 2010 Posted January 5, 2010 just put the fieldname and i guess that's not good enough. It would have been good enough if you had included the table name. But it would break if the field were renamed.
stefangs Posted January 6, 2010 Author Posted January 6, 2010 It would have been good enough if you had included the table name. But it would break if the field were renamed. actually, this didn't work. when i revoved the GetFieldName from the script parameter, but left the table name, it didn't work. but no problem, i'll just include GetFieldName. renaming would break it of course, but no more than renaming the object. i think with the field name it's a little more intuitive and saves me from assinging object names on top.
comment Posted January 6, 2010 Posted January 6, 2010 I am not sure I follow your description, so let me clarify: the script parameter can be either = "Table::Atribute" or = GetFieldName ( Table::Atribute ) Both return the same result - but the GetFieldName() variant will keep working if the field is renamed.
stefangs Posted January 6, 2010 Author Posted January 6, 2010 I am not sure I follow your description, so let me clarify: the script parameter can be either = "Table::Atribute" or = GetFieldName ( Table::Atribute ) Both return the same result - but the GetFieldName() variant will keep working if the field is renamed. you're right - i didn't have quotes around the first option and so it didn't work. now it does. thanks!
Recommended Posts
This topic is 5436 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