Announcement

Collapse
No announcement yet.

URL-capable edit box?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • URL-capable edit box?

    Hi,

    I remember d'loading a demo from the server that demonstrated how to turn regular text into hyperlinks, but I can't find it anymore. I guess it was a RichText box. For testing purposes, I edited an RTF document in Word which only had a URL in it, opened it in my app, and sent the input to a RichText box. The text is displayed as a URL would look like, but it's not clickable.

    Any idea where that sample is located on the server? I seem to recall it was from Peter Scheutz.

    Thx
    FF.

    ------------------

  • #2
    I don't have exactly taht but I have code from here (PBURL) that allows you to do say, a label etc...
    But it basically does a ShellExecute to execute the URL, basically is underlined font with the cursor changing when it goes over it, and when the click message is received that is when the shellexecute occurs...

    But if what you are looking for is a rich edit box that has that built in, way cool...let me know if you find something like that!

    Scott

    ------------------
    Scott Turchin
    MCSE, MCP+I
    Computer Creations Software
    http://www.tngbbs.com/ccs
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      The newest richedit (v3 i think) supports hyperlinks.


      ------------------
      hellobasic

      Comment


      • #4
        originally posted by frederic faure:
        any idea where that sample is located on the server? i seem to recall it was from peter scheutz.
        the code is here: http://www.powerbasic.com/support/pb...ead.php?t=3970

        it's not quite finished, but shows one way to do it.

        it uses the id field of the charformat2a type to store an index value.
        a global array is used to hold the actual hyperlink.





        ------------------
        best regards
        peter scheutz
        Best Regards
        Peter Scheutz

        Comment


        • #5
          Thanks to everyone. I checked c:\winnt, and no less than three versions are there: RICHED.DLL, RICHED20.DLL, and RICHED32.DLL (the one I was using). RICHED.DLL doesn't load, though.

          => BTW, does anyone have a pointer to how the 3.2 version supports hyperlinks?

          I looked at an RTF file that I created in Word with just a single URL, and the structure looks pretty daunting. I think it's OK for URLs not to appear when the user sends a message and it's also OK to only supports URL-ready text (ie. the user must either type a link that starts with a "www.", or add "http://" if the URL doesn't include www. as its prefix), but I'll have to turn basic text into RTF so that URL's appear clickable on the receiving end. Since it's freeware, I'd rather do without commercial add-ons.

          More infos on creating RTF text programmatically: http://www.undu.com/Articles/981027d.html

          Thx again
          FF.

          ------------------

          Comment


          • #6
            For those interested, here's how to add plain text and a URL into a RichEdit text box. It remains to add code in your application to change the cursor to the familiar arrow to show users that (yes) it's a clickable link, parse that token to extract the URL (should be easy thx to PB/DLL 6's regex support), and launch the default browser with the ShellExecute() function:

            {\rtf1\ansi\ansicpg1252\deff0\deflang1033

            {\colortbl;\red0\green0\blue255;}

            {\stylesheet
            {\*\cs15 \additive \ul\cf1 \sbasedon10 Hyperlink;}
            }

            Before URL
            {\par }

            {\field
            {\*\fldinst {HYPERLINK http://www.powerbasic.com } }
            {\fldrslt {\cs15\ul\cf1 http://www.powerbasic.com} }
            }
            {\par }

            After URL

            }

            HTH
            FF.



            ------------------

            Comment


            • #7
              For Rich Edit 2.0 or later, I belive you just:
              Call SendMessage( hEdit, %EM_AUTOURLDETECT, %True, 0 )

              That should work for these links types:
              http:, file:, mailto:, ftp:, https:,gopher:, nntp:, prospero:, telnet:, news:, wais:

              I think the mouse pointer will change when over the links.

              ------------------
              Best Regards
              Peter Scheutz
              Best Regards
              Peter Scheutz

              Comment


              • #8
                %EM_AUTOURLDETECT is not defined in the .INC files, so I guess it's a user-defined equate?

                Should I send this message when the user clicks on any part of the richedit box?

                I'll read your code snippet tonight. I might even figure it out The latest and greatest of Petzold and Rector/Newcomer are on my Amazon wish-list.

                Thx
                FF.

                ------------------

                Comment


                • #9
                  RICHEDIT.H(145): #define EM_AUTOURLDETECT (WM_USER + 91)

                  ------------------
                  Fred
                  mailto:[email protected][email protected]</A>
                  http://www.oxenby.se

                  Fred
                  mailto:[email protected][email protected]</A>
                  http://www.oxenby.se

                  Comment


                  • #10
                    That was fast

                    Is richedit.h part of the SDK?

                    That's what I'm aiming at:
                    http//www.codeguru.com/richedit/RichEdit20.shtml

                    Thx
                    FF.



                    ------------------

                    Comment


                    • #11
                      that's what i'm aiming at:
                      http//www.codeguru.com/richedit/richedit20.shtml
                      i posted an example in the source code forum: http://www.powerbasic.com/support/pb...ad.php?t=24632


                      ------------------
                      best regards
                      peter scheutz
                      Best Regards
                      Peter Scheutz

                      Comment


                      • #12
                        Thx! I got it working after reading samples for Delphi programmers. I don't have to play with RTF anymore. Just as well

                        Ciao
                        FF.


                        ------------------

                        Comment

                        Working...
                        X