PDA

View Full Version : Form not locked down


ABC123

Bob Arbuthnot
01-23-2014, 08:30 PM
I have a form that is modal entry that I need to control the user's new entries, changes, and saves thru buttons on the form. I have just noticed that when I right click when hovering over a hidden conditional object that right click is active for enter, change, and cancel actions. I also notice that pressing the F3 key on the keyboard puts the form in 'change' mode.

I have right click turned off in the form properties and also on all fields on the form. What else can I do to finish locking this form down the way I need it to be?

As always, any help would be greatly appreciated.

Bob Arbuthnot
Belleville, KS.

johnkoh
01-24-2014, 02:16 AM
see,
<OBJECT>.ALLOW_CHANGE()

Bob Arbuthnot
01-24-2014, 01:17 PM
John, thanks for responding.

I tried putting cond1.ALLOW_CHANGE(.f.) in the on-activate event for the form, alas right clicking when hovering over the hidden object (cond1) still allows enter, change, and cancel actions off the right click menu. The F3 key still puts the form in change mode. I'm going to let this thread sit out here for another 24 hours or so and see if anyone has any other thoughts. If no one does I'll submit a bug report.

Bob Arbuthnot

Bob Arbuthnot
01-24-2014, 02:49 PM
OK, I entered the following code in the form's OnKey event to disable the F3 key:


If a_user.key.value="{F3}"
a_user.key.handled=.T.
if a_user.key.event="down" then
end if
end if

Also, used the same code to disable the F8 key (opens the underlying table in browse view).

Am still at a loss as to what to do about the right click over a hidden conditional object that opens up the right click menu for change, enter, and cancel on a modal form with right click disabled for 1)the form, and for 2)all fields on the form.

johnkoh
01-24-2014, 05:00 PM
Bob,



Preventing any changes to a form
Perhaps you want to prevent the user from making any changes on your form. That is simple in Xbasic. The
new properties we will use are:
<form_pointer>.restrict_enter
<form_pointer>.restrict_change
which are akin to changing the properties of the form in design mode, and the property
browse_name.browse.readonly
which changes the editing properties of a browse.

Tom Cone Jr
01-24-2014, 05:11 PM
Bob, its beginning to sound like you might have to redesign form to work around the CO behavior. You also should consider submitting a formal bug report... or would you consider this a new feature wishlist item?

Truly locking down a form takes a lot of work. You might be ahead of the game to use an xdialog instead of the form.

Another idea: what happens if you put a cancel() in the CanArrive event for the CO?

Bob Arbuthnot
01-24-2014, 05:37 PM
Hi, Tom. Long time no taco! Thanks for responding.

Hadn't thought about creating the form as an xdialog, might explore that.

To my way of thinking this is a bug. Why would you ever want an action to only be active when right clicking over a hidden object???

Is CanArrive even available for a CO (especially a hidden one!)???

ba

martinwcole
01-25-2014, 02:13 PM
the best way to handle forms is to set the data entry to modeless, and in the onfetch event say parentform.allow_change(.f.)
then put a button on the form - Edit, and say parentform.allow_change(.t.)

this is much better than parentform-modal.

Tom Cone Jr
01-25-2014, 02:17 PM
Bob, the docs suggested canArrive is available, but when I try to implement the idea, no can do. Sorry.

Bob Arbuthnot
01-25-2014, 04:42 PM
Martin, thanks for the post and the advice.

I tried putting parentform.allow_change(.f.) in the form's onfetch event. Still, when you right click on the space occupied by a hidden conditional object the right click menu appears with the options to change, enter, or cancel available. As I stated above, right click menu is turned off for the form and for all fields on the form.

I think this is a bug. I will try to get a bug report submitted this weekend with a sample form, etc.

ba

Bob Arbuthnot
01-25-2014, 07:55 PM
Thanks anyway, Tom. I still appreciated the input.

ba

martinwcole
01-25-2014, 08:46 PM
Bob, I doubt that the right click is happening on the conditional, rather the form itself

Bob Arbuthnot
01-26-2014, 07:13 PM
Martin, see for yourself in attached db. Bottom half of form is a hidden conditional object, top half is not. Right click on bottom half and you get right click menu to cancel, enter, change, or save. Right click on top half and nothing happens.

ba

Bob Arbuthnot
01-26-2014, 07:20 PM
Bug report submitted. I will post here what I hear back.

ba

Bob Arbuthnot
01-26-2014, 07:52 PM
Work around received back from Selwyn (you gotta admire these guys committment to their product!).

ba


thanks.

i look like it is a limitation, not a bug - you can't set the right click menu for a conditional control.

there is a work around that might meet your needs. see video.

http://screencast.com/t/PU20YquRnHxH

martinwcole
01-26-2014, 09:29 PM
I tested on 10.5 and 11 and the limitation is there, too
In Selwyns example, use a separator instead and nothing will show

Bob Arbuthnot
01-26-2014, 10:05 PM
Martin,

Thanks for the 'separator' idea from Selwyn's example. That's a little cleaner fix to his workaround.

ba

Bob Arbuthnot
01-30-2014, 06:01 PM
Interesting caveat to anyone considering using Selwyn's suggestion from above. It does work, BUT it will make the change on ANY app you run on that PC AND it will be there whether the app is opened or running under the Runtime or Developer's edition. In other words this change for some reason is GLOBAL across all A5 apps running on the same PC.

RCarvalho
01-31-2014, 10:49 PM
Interesting caveat to anyone considering using Selwyn's suggestion from above. It does work, BUT it will make the change on ANY app you run on that PC AND it will be there whether the app is opened or running under the Runtime or Developer's edition. In other words this change for some reason is GLOBAL across all A5 apps running on the same PC.


But it appears that the fix only affects one pc but no one else accessing the database. In other words, you will need to apply the suggestion to all the user's PC's. I do not think it would make sense on a multi user LAN unless there is way to push the changes to all users via a script??

johnkoh
02-01-2014, 01:40 PM
Bob,

I have enclosed the Screen Shots for you. I hope it will help you.


I also notice that pressing the F3 key on the keyboard puts the form in 'change' mode.

375603756137562

Step 1 - Applied the "Form property" set which is same as this and I prefer use "form Property" instead of use "this code on the Event"


'Preventing any changes to a form
'Perhaps you want to prevent the user from making any changes on your form. That is simple in Xbasic. The
'new properties we will use are:
'<form_pointer>.restrict_enter = .t. ' No enters allowed at form level
'<form_pointer>.restrict_change = .t. ' No changes allowed at form level
'which are akin to changing the properties of the form in design mode, and the property
'<browse_name>.browse.readonly = .t. ' No enters or changes allowed for invoice header browse

Step 2 - each button has the code as you wish to have the action such as edit, delete, save ... and "restrict" again.

Final -- You are not able to change, delete the record from current form even you selected from A5 menu or pressed "F3".

Bob Arbuthnot
02-01-2014, 03:08 PM
John,

I posted a way to disable the F3 button above.

In your example of Step 2, is your conditional object hidden on the form? If not, then make it so and then right click on the area where the CO resides. Does the right click menu appear with the options to enter, change, or save? If so, then the user can effectively bypass the buttons you have placed on the form and by doing so they will bypass any extra code you may have on those buttons.

johnkoh
02-01-2014, 03:42 PM
Bob,

I did for your
What else can I do to finish locking this form down the way I need it to be?

I did not know you are looking for
a way to disable the F3 button above

Yes, and Yes. There is a Field property to disable the RIGHT-Click button. you have to set the property for all of the fields. you will not see the right-click menu at all. Note; It will works with the Form Property restriction.