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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User defined property in Property-window

EinTerraner

Technical User
Jul 17, 2024
33
1
8
DE
I did it already..... but it was in 2009/10 and i forgot HOW TO.

if have some properties in an object. DefaultProps can be modified by doublecklick to change their value. i.e. flip between .T. and .F.
1.) How to do the script to toggle a boolean property between .T. and .F.
2.) how do the script for an numeric expression like the alignemnt like here in a textbox?
Frm_350.jpg
 
I did it already..... but it was in 2009/10 and i forgot HOW TO.

if have some properties in an object. DefaultProps can be modified by doublecklick to change their value. i.e. flip between .T. and .F.
1.) How to do the script to toggle a boolean property between .T. and .F.
2.) how do the script for an numeric expression like the alignemnt like here in a textbox?
View attachment 329
Oddly enough I just answered a very similar question just moments ago and the code is identical.

To toggle a logical property you can do this.

Code:
IF MyButton.Enabled
   MyButton.Enabled = .F.
ELSE
   MyButton.Enabled = .T.
ENDIF


To toggle use alignment values from 0 to 3, you can do something like this to cycle from 0 to 3.

Code:
IF MyTextBox.Alignment < 3
   MyTextBox.Alignment = MyTextBox.Alignment + 1
ELSE
   MyTextBox.Alignment = 0 && start over
ENDIF
 
You mean at design time, don't you, EinTerraner? I don't think you have the option to design that like a dropdown list of the possible values of a native property like alignment.
What you may control is a script that intellisense runs, when you write objectnamepropertyname= and space. For that to work, the editor will need to know the objectnames class, otherwise you don't trigger intellisense.
 
Yepp.. I forgot in my TP to mention "at design time"
Well, this DropDown is not sooooo important. but i'd like to use the doubleclick on an user defined boolschen property, just like the native props (i.e. .Enabled) . I know it works. I had this in an very old defined object. but this is already lost. But i dnt have any experience with those scripts (shame on me)
 
Yepp.. I forgot in my TP to mention "at design time"
Well, this DropDown is not sooooo important. but i'd like to use the doubleclick on an user defined boolschen property, just like the native props (i.e. .Enabled) . I know it works. I had this in an very old defined object. but this is already lost. But i dnt have any experience with those scripts (shame on me)
Look into the PEM Editor in the Thor Project at https://github.com/VFPX/Thor. It does that for custom properties as well as native properties (of course). And it does so much more!
 
Less code for toggling T/F value for a check box:

Code:
thisform.checkbox.value = !thisform.checkbox.value

Or for toggling a T/F property value:

Code:
thisform.mybutton.visible = !thisform.mybutton.visible
 
GTGeek88 said Thor's PEM Editor.

You get it by getting Thor, you only need to go through the PEM Editor dcumentation, not all of Thor.
 
Simply put, you can use MemberData for this purpose.

For example, you have two attributes: test and testdesc. then, you can write the following script through MemberData Editor:
Code:
If Aselobj(LoSelobj) = 0
    Aselobj(LoSelobj, 1)
Endif

If LoSelobj[1].Test = 1
    LoSelobj[1].Test = 2
    LoSelobj[1].TestDesc = [test's value is 2]
Else
    LoSelobj[1].Test = 1
    LoSelobj[1].TestDesc = [test's value is 1]
Endif

Close the MemberData Editor and then double-click on the property test in the Properties window to see it in action.
 

Part and Inventory Search

Sponsor

Back
Top