Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot enable textbox of a form

Status
Not open for further replies.

iara84

Systems Engineer
Oct 25, 2022
13
CO
From a main form, with a button I open the second form, this one has four text boxes.
In the init of the form second form add

with this form
.setall('enabled',.t.,'textbox')
.setall('enabled',.t.,'label')
end with
thisform.refresh()

when I open the second form using the button from the main form the tet box and label do not appear, but when I run the second form they do appear
 
First, the code you posted seems to be completely unnecessary. It is simply enabling all the the labels and texboxes in the second form. But labels and textboxes are always enabled by default, so there is no need to do it explicitly. I suggest you start by removing that code - of only to avoid distracting you.

That said, when you say that the textboxes and labels don't appear, do you meant that they are completely invisible? If so, are you sure that you haven't set their Visible property to .F. at some point, either at design time or in your code? The fact that the problem only occurs when you launch the form from a button on another form suggests that there is something wrong with that other button's code. You should check that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Well, I think there is a reason you do that, only remove the code, if the textboxes and labels are by default enabled.

You may have based your form on some of the FFC classes that include a navbar and an editmode, which start with controls disabled or readonly. But you may do this enabling too early, because that navigation mode / not editing mode is what the form starts with, but might be set up after you already enabled all controls.

If you show your button code to statr the form, there could be more said, also please tell us where that setall() code is. With THisForm (if it is that) suggests this code is within the form started, so it's happening no matter from where you start it. You would need to find out the reason it is done in one case and not in another. I recommend single stepping in the debugger to see what happens in all the events that are happening at form start, that's not only load, init, but also might include the show method and the gotfocus of the control with taborder 1. And there could be code overriding all you do with your setalls.

And last not least, as Mike also already addresses the enabled property controls whether you can set focus to a control and edit it's value. It's not controlling the visibility of controls, that's done by the visible property. A readonly state also is better for allowing users to not only better read with more color contrast - the controls are not greyed - you also can set focus into them, select and copy text.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top