Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a TextBox in code at runtime form a button
Message
From
20/09/1997 12:38:57
Frank Shaw
Runestones Development Corporation
Ipswich, Massachusetts, United States
 
 
To
19/09/1997 10:21:59
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00050429
Message ID:
00050910
Views:
51
>>>>I want to create a textbox in code from a command button use the textbox to enter so text and then destory the
>>>>text box after I am done with it. I want to know If it is posiable to do this in visual foxpro 5.0a. If so what would the code look like to do it? I do realize that I could create the text box at design time and play with the
>>>>visiable properity. But I want to create the textbox at runtime not design time.
>>>>
>>>>
>>>>Frank H. Shaw
>>>>fshaw@runestones.com
>>>
>>>**** cmd Click event
>>>thisform.addobject("text12","textbox")
>>>with thisform.text12
>>> .left=5
>>> .width=100
>>> .top=15
>>> .visible=.t.
>>>endwith
>>>**** another cmd Click event
>>>thisform.removeobject("text12")
>>
>>
>>Edward Pikman I created this code but it will not work can you tell me what is wrong with the code. I am geting syntax errors trying to get out of the editor.
>>
>>
>>
>>
>>if !(plEdit_Flag)
>> plEdit_Flag = .T.
>> && We need to create on this form a textbox that we can use to type in the name
>> && of the company because we do not want to type the name directly into the combobox
>>
>>
>> ThisForm.cntbizcompany.ADDOBJECT("txtEditCompany","textbox")
>>
>> thisform.cntbizcompany.txteditcompany.FontSize = 9
>> thisform.cntbizcompany.txteditCompany.height = 22
>> thisform.cntbizcompany.txteditCompany.left = 228
>> thisform.cntbizcompany.txteditCompany.top = 7
>> thisform.cntbizcompany.txteditCompany.visible = .T.
>> thisform.cntbizcompany.txteditCompany.width = 301
>> thisform.cntbizcompany.txteditCompany.name = "txtEditCompany"
>>
>>
>> thisform.cmdeditcompany_name.caption = "Remove"
>>
>>
>> DEFINE CLASS mytextbox AS txtEditCompany
>>
>> PROCEDURE keypress
>> LPARAMETERS nKeyCode, nShiftAltCtrl
>>
>> if nKeyCode = 13
>>
>> Set Step On
>>
>> Endif
>>
>> ENDPROC
>>
>> ENDDEFINE
>>
>>else
>> && plEdit_Flag True
>> && We need to remove the textbox from this form
>>
>> ThisForm.cntbizCompany.RemoveObject("txtEditCompany")
>> plEdit_Flag = .F.
>>
>> thisform.cmdeditcompany_name.caption = "Edit"
>>
>>
>>Endif
>>
>Class and subclass definitions created with DEFINE CLASS cannot be placed within structured programming commands, such as IF ... ENDIF or DO CASE ... ENDCASE. Nor can they be placed in loops, such as DO WHILE ... ENDDO or FOR ... ENDFOR.


Thank You

All I had to do was move the Define Class code to a PRG and it works fine. Now unstead of the Set Step On for the debug I want to
do the following on the fly. Create a system small window that will remain on the screen until the user uses one of the command buttons. I want the window or form to contain some writing and a text box with the same string that I type into the textbox on the existing form. I need help with the understanding of creating a window or form on the fly what should that code look like.


Thanks
fshaw@runestones.com
Previous
Reply
Map
View

Click here to load this message in the networking platform