Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alternative to SetAll()
Message
From
02/05/2005 12:02:58
 
 
To
29/04/2005 11:59:13
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01009427
Message ID:
01010175
Views:
17
Thanks Greg. I have actually created a very similar solution. This will help me validate my code as well.

>>Hi all,
>>
>>I have a form with a pageframe containg 4 pages. There are several Label objects in each of the page. Some of the label's caption has the word "Week" in it. I would like to do a wholesale programmatic replace, STRTRAN() if you may, for each occurence of "Week" in a Label.Caption with "Month". I think I cannot use Form.SetAll() for this. I am using AMEMBERS() but I think I may have to drill down for each container objects where they may exist (ie. PageFrame). Is there a better way to do this?
>
>Try this. Save to PRG file called CaptionReplace. And in your INIT event, call it as
>
>
CaptionReplace( Thisform, "Week", "Month" )
>
>
>*------------------------------------------------------------
>* Description: 	Scan for Caption properties, and replace a string with another.
>*               Child objects are recurred and change also.
>* Parameters:   tcObj, req, def=, Base object to be translated.
>*               tcSearch, req, def=, String to search for.
>*               tcReplace, req, def=, Replacement string
>* Return:       n/a
>* Use:          n = CaptionReplace( Thisform, "Week", "Month" )
>*------------------------------------------------------------
>* Id Date        By                     Description
>*  1 04/29/2005  Gregory L Reichert     Initial Creation
>*------------------------------------------------------------
>
>LPARAMETER tcObj, tcSearch, tcReplace
>
>LOCAL oObj
>
>FOR EACH oObj IN tcObj.OBJECTS
>
>    IF ( PEMSTATUS(oObj,"Caption",5) AND (TYPE("oObj.Caption")<>"U") AND NOT EMPTY(oObj.CAPTION))
>        oObj.CAPTION = STRTRAN( oObj.CAPTION, tcSearch, tcReplace,1,100,1)
>    ENDIF
>    IF ( PEMSTATUS(oObj,"TooltipText",5) AND (TYPE("oObj.TooltipText")<>"U") AND NOT EMPTY(oObj.TOOLTIPTEXT))
>        oObj.TooltipText = STRTRAN( oObj.TooltipText, tcSearch, tcReplace,1,100,1)
>    ENDIF
>    IF ( PEMSTATUS(oObj,"StatusbarText",5) AND (TYPE("oObj.StatusbarText")<>"U") AND NOT EMPTY(oObj.STATUSBARTEXT))
>        oObj.StatusbarText = STRTRAN( oObj.StatusbarText, tcSearch, tcReplace,1,100,1)
>    ENDIF
>
>    IF PEMSTATUS(oObj,"Objects",5) AND TYPE("oObj.OBJECTS(1)")="O" AND TYPE("oObj.OBJECTS.COUNT")="N"
>        IF oObj.OBJECTS.COUNT>0
>  			CaptionReplace( oObj, tcSearch, tcReplace )
>        ENDIF
>    ENDIF
>NEXT
>
>RETURN
>
>* eof
>
ramil
~~ learning to stand still
Previous
Reply
Map
View

Click here to load this message in the networking platform