Unknown symbol 'textbox1' in class container-gambas error - gambas

I had copied data from one form to another previously and it worked bt right now when I am trying to copy the detail of field 'PASSPORT' from login.form to from_to.form it shows an error.
here's the login.form
and here's the from_to.form with error

Controls are not properties of their forms, and moreover they are not (by default) public.
In other words, you access controls by using a global variable having the same name as the control, and only from inside the form, as that global variable is private.

As mentioned above the controls are private to each form and not visible to each other unless you make them public.
You are trying to access login.TextBox1 from another class.
To access login.TextBox1 from the from_to.class you must do one of the following...
In the IDE on the login form select TextBox1 and set it's Public property to True.
or..
Open the project properties and select the "Make all controls public" option. this makes all controls visible across all forms.

Related

Import Umbraco property editor

We have site where a user went to the Data Types, saw we had a Content Picker data type using "(Obsolete) Content Picker" (Umbraco.ContentPickerAlias) and changed it to Umbraco.ContentPicker2
Our code relies on the obsolete one currently and now he cannot set the content we want him to.
Is there a way to recreate/reimport the Obsolete property editor into Umbraco?
On the Data Types node you can click on the ... and create a 'New data type' - then select the obsolete one to create it again.
But in theory, I believe you could just do the opposite of what the user did, on the ContentPicker click edit and pick the property editor from the dropdown if available?
Within the umbracoSettings.config file, there is a property you can create/set to true that will make obsolete data types become available to use against data types
<showDeprecatedPropertyEditors>true</showDeprecatedPropertyEditors>

How to auto update many descendants forms after ancerstor form had an control deleted?

Suppose a TAncestorForm with an extra button (or any other control). If I remove the button, whenever I open a descendant of TAncestorForm the Delphi IDE shows a message "Ancestor component not found..." and let me choose:
Remove the reference;
Tell that the component was renamed and what is
it's new name;
Recreate the component;
I want the first option. There is any other option that would do this automatically instead of opening all descendants (like dozens of them) and clicking in each message?

Getting the name of newly created components at run time

Essentially, I want a user to add comments in the form of labels. I have implemented this no problem, but I want the user to be able to delete the newly created labels.
comment := TLabel.Create(Self);
comment.Parent := Form1;
I want to add Labels during runtime, and then fill a combobox or a stringgrid or something similar with the name or any sort of a reference to that label, so that the user can then delete that label.
How would I get the name of the newly created label for a reference ?
Thanks for any help.
Components that you create yourself don't have a Name assigned unless you explicitly assign one yourself. It is the IDE that synthesizes a Name when you drop a component on the form at design-time.
You can just assign whatever Name you feel like, as long as it's a valid component name (unused, no spaces, and so on), and then the component can be found via its Owner.FindComponent() method, if you don't keep track of the component yourself. Otherwise, put the component into your own list/array so you can find it later.
The name of a component can be read from its Name property:
comment.Name
You can write to that property to give the component a name that is amenable to showing to users. You'll want to do that when you create a new component dynamically because it won't have a name until you name it.
There's no need for you to use the Name property if you don't wish to. You can use naming of your own choice. For instance you may wish to use names that contain spaces. Or not be constrained from using names that are already in use by the static controls. Hold the components in a dictionary with the name as the key and the component as the value. My advice is that you go down this second path.

IBM Rational Doors : all changes are lost in module after closing

That is, after adding new columns and objects to a module and closing/saving these changes, I manually reopen the module and the columns are gone, although the objects remain in their appropriate places. can anybody tell me how to solve this issue...
You need to save the View, not just the Module.
The following Procedure is taken from IBM's Help Page
Procedure:
In the module window, click View > Save As.
On the General tab, type the name. To overwrite an existing view,
type the name of the view you want to overwrite. Note: View names
are case sensitive. To overwrite an existing view, you must type the
name exactly as it appears in the Views list.
Optional: Enter additional information about the view in the
Description box.
Optional: Select or clear the Remember Settings for options.
Optional: Select a Default option for the view. The default view is
the view that is displayed when the module is opened. If you do not make it a default view, it is listed in the views list and can be
selected when the module is open.
Use the Access to this view section to define whether the view is
private or public.
Optional: Set additional rules for the view on the Advanced tab.

Make all form fields readonly in MVC

I am displaying 3 or more versions of a form. One version is an edit form to edit all fields. A second version will be a read only version of the same form which will be used to show all the same fields but with all fields having readonly="true" on the client side so that the user cannot enter data. The readonly fields need to use a different css style. This is to display archived data. I am already hiding the submit button so they can't submit but I want the form to look like it is readonly. A third version will have some fields readonly and some editable for a particular class of users that has limited editing privileges.
I am using ASP.NET MVC 1.0. How do I modify all (or a subset) of the fields displayed so they are readonly. I would like to iterate through the collection of fields in the controller and set them all to readonly and also set the correct css class. I don't want to have to put an if statement on every field in the .aspx file (there are 40-50 fields) and I'd prefer not to have this on client side so I can prevent users from modifying javascript/html to edit things they are not supposed to.
TIA,
Steve Shier
Keep in mind that even if you set the tags as readonly on the server side, users can still change them through a variety of means, and whatever the value on the form is before it gets sent back to you.
Certainly the easiest way is client-side with jQuery:
$(function() {
$('input, select, textarea').attr('disabled', 'disabled');
});
Or, you could do it in your View, but it's ugly. Off the top of my head, you would need some sort of bool passed into the View (via ViewData I suppose), and check that on each Input to see if you should add the disabled attribute. Not my idea of fun...
I would have different views that correspond to your states and then choose the view depending on which state you are in. You could also implement it with partials, breaking down the pieces so that you can easily include editable or read-only versions of the different sets of elements. The read-only view, then, need not even include a form element. You could also present the data in spans, divs, or paragraphs rather than as input elements.
Note: you'll still have to check whether the current user has the ability to update/create data in the actions that process form submits. Just because you limit the ability to view data in a read-only format, that won't stop someone from crafting a form post to mimic your application if they want. You can't rely on hiding/disabling things on the client to prevent a malicious user from trying to enter/modify data.
I usually use partial views to represent forms and/or parts of forms.
I can think of two simple ways to do what you need (as I understood it):
<% Html.RenderPartial(the_right_partial, model); %> where the_right_partial is either a value passed from the controller or a helper (in which case, the_right_partial(something));
pass a bool or enum paramether from controller representing editability and then using a helper to obtain the right htmlAttributes, like:
<%= Html.TextBox("name", value, Html.TheRightHtmlAttributesFor(isReadableOrNot)) %>;
There may be other ways, like creating new helpers for input fields which accept an additional isReadableOrNot arg (but it seems an overkill to me), or like mangling the html/aspx in some odd (and totally unreadable/unmaintainable way), but I'd not suggest them.
Notice that using html attributes like disabled is client side, and with tools like firebug it takes just two seconds to change them.
Others have already said it, but I also have to: always assume that the user will do his/her best effort to do the worst possible thing, so check the user rights to modify stuff on server side, and consider client side checks as a courtesy to the user (to let her/him understand that the form is not supposed to be edited, in this case).
Since I am trying to use a single partial for the different states of the form, I am thinking I will create helper functions which will display correctly based on the state and the user. The helpers will use a dictionary of fields that will indicate under which condition the field is read only. I will still have server side checks to make sure data is valid and the user is authorized to make changes.
Thanks for all of your ideas and help.
Steve

Resources