Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Par2: Changing control properties at runtime - Procedure 1998-04-22 -- Jeff Berlinghoff I have seen several people stating that they want to make changes to a bunch of
controls at one time, and asking how to do it. I've had this procedure in mind for a while,
and just recently had a need to do it several times in a form, so I took the opportunity to
do it right.
Examples:
1. Disable all Entry Controls: SetControls(Prop:Disable,,,1,CREATE:Entry)
2. Make all Buttons Flat (note that this is a four step process)
a. Include BLANK.ICO in the project
b. SetControls(Prop:Icon,,,'~BLANK.ICO',CREATE:Button)
c. SetControls(Prop:Left,,,1,CREATE:Button)
d. SetControls(Prop:Flag,,,1,CREATE:Button)
3. Set the background color for all entry controls:
SetControls(Prop:Color,,,COLOR:BtnFace,CREATE:Entry)
4. Set Range of Prompts in Blue
SetControls(Prop:FontColor,?PromptX,?PromptY,COLOR:Blue,CREATE:Prompt)
OR (to show off using Array Index in property)
SetControls(Prop:Font,?PromptX,?PromptY,COLOR:Blue,CREATE:Prompt,3)
For 2, it might be slightly quicker if you wrote your own loop and only go through it one time and set
all three settings at once, but this happens so quick it shouldn't be significant (under normal
situations).
This also opens up an easy avenue for providing more user control over settings such as display colors.
Procedure Name: SetControls
Procedure Category (not avail in CW2): Utility, Window Control
Procedure Type: Source
Prototype: (Long, Long=0, Long=0, ?, Long=0, Long=0)
Parameters: (CtlProp, FirstFld, LastFld, FldValue, CtlType, ArrayIndex)
Embed Data Section:
Fld LONG
Embed Processed Code:
IF FirstFld=0 THEN FirstFld=FIRSTFIELD().
IF LastFld=0 THEN LastFld=LASTFIELD().
IF FirstFld > LastFld !Extra precaution
Fld=FirstFld; FirstFld=LastFld; LastFld=Fld
END
LOOP Fld=FirstFld TO LastFld
IF CtlType=0 OR FLD{prop:Type}=CtlType THEN
Fld{CtlProp,PropArrayIndex}=FldValue.
END
It assumes your window is open at the time, or if modifying a report that SetTarget has been issued.
Today is November 23, 2024, 2:13 am This article has been viewed 35199 times.
|
|