IonicWind Software

IWBasic => General Questions => Topic started by: tbohon on January 30, 2007, 11:57:15 AM

Title: Help with Case
Post by: tbohon on January 30, 2007, 11:57:15 AM
I have a form with a single rich edit box (window is 'w', control ID is '8') and I'm trying to do the following:

Copy the data from the box to a string, parse the string elimininating all chr$(10) and chr$(13) (cf/lf pairs) and rewrite the cleaned string back to the same rich edit box.  What I'm getting is a blank rich edit box after I write it ... so I'm thinking that perhaps the SELECT-CASE is malformed.

Here's the code involved:


    wvar1$ = ""
    wvar2$ = ""
    wvar3$ = ""

    rv = CONTROLCMD(w,8,@RTSAVE,wvar1$)

    for j=1 to len(wvar1$)
        c$ = mid$(wvar1$,j,1)

        SELECT c$
            CASE chr$(10)
            CASE chr$(13)

            DEFAULT
                wvar2$ = wvar2$ + c$

        END SELECT

    next j



CONTROLCMD w,8,@RTSETSELECTION,0,-1
CONTROLCMD w,8,@RTDELETESEL

CONTROLCMD w,8,@RTLOAD,wvar2$



At what point am I going wrong here?

Thanks in advance.

Tom
Title: Re: Help with Case
Post by: Rod on January 30, 2007, 12:34:06 PM
The SELECT CASE is fine. Try putting a type indicator as the last argument on that @RTLOAD command. 0=ASCII, 1=RTF.

CONTROLCMD w,8,@RTLOAD,wvar2$,0
Title: Re: Help with Case
Post by: Ionic Wind Support Team on January 30, 2007, 02:31:37 PM
        SELECT c$
            CASE chr$(10)
            CASE& chr$(13)
            DEFAULT
                wvar2$ = wvar2$ + c$

        END SELECT

CASE& is used for grouping case labels together.
Title: Re: Help with Case
Post by: tbohon on January 30, 2007, 08:15:30 PM
Note to self:  Read the documentation ... read the documentation ... read the documentation ...   ::)

Thanks, Paul.
Title: Re: Help with Case
Post by: Jerry Muelver on January 30, 2007, 09:07:16 PM
Damn clever use of SELECT...CASE, I must say....