April 27, 2024, 09:27:42 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Help with Case

Started by tbohon, January 30, 2007, 11:57:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tbohon

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
"If you lead your life the right way, the karma will take care of itself ... the dreams will come to you."  -- Randy Pausch, PhD (1961-2008)

Rod

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

Ionic Wind Support Team

        SELECT c$
            CASE chr$(10)
            CASE& chr$(13)
            DEFAULT
                wvar2$ = wvar2$ + c$

        END SELECT

CASE& is used for grouping case labels together.
Ionic Wind Support Team

tbohon

Note to self:  Read the documentation ... read the documentation ... read the documentation ...   ::)

Thanks, Paul.
"If you lead your life the right way, the karma will take care of itself ... the dreams will come to you."  -- Randy Pausch, PhD (1961-2008)

Jerry Muelver

Damn clever use of SELECT...CASE, I must say....