URLs not enabled in Textbox control 
Author Message
 URLs not enabled in Textbox control

Dear VB Gurus,

In VB6 we are using a Textbox control to display some text. The text
contains few links(URLs) and email addresses. The problem is that
these URLs and email addresses are not enabled here. That is, these
are neither in blue color nor converting mouse pointer to hand when
mouse is over them and not accepting mouse click to launch the URL
under mouse pointer etc. This means that Textbox control is not
capable of handling URLs and email addresses.

We have also tried Richtextbox control but the same problem persists.
Is there a control(preferably from VB standard controls) which can be
used to display the text with URLs in enabled form.

We also thought to get benefit from MS WORD using OLE concept, but in
this case WORD must be opened within our application to give the
impression that this is a part of our application. If you think this
is feasible then can you please provide some example code to achieve
this? Please note that we wish to open WORD in our own application
instead of opening a separate instance of WORD.

Thanks in advance.

Faiz



Sun, 03 Apr 2005 13:37:06 GMT  
 URLs not enabled in Textbox control
Neither of the controls handle Links - this is not a problem or a bug, it
how the controls work...Just roll your own with a label control is the
easiest - Change its forecolor and mousepointer and you should be able to
get the desired affect..

If your not looking at doing it yourself, just do a search on google and you
should find many examples..

--
Veign
www.veign.com
NEW ActiveX Control - Jeweled Style Buttons
www.veign.com/download_activex.html#jwldbutn
Code Samples & Sample Projects
http://www.veign.com/information/application/info_app.html
Submit Your Best Code (you keep the rights)
http://www.veign.com/information/application/code_submit.html
---------

Quote:
> Dear VB Gurus,

> In VB6 we are using a Textbox control to display some text. The text
> contains few links(URLs) and email addresses. The problem is that
> these URLs and email addresses are not enabled here. That is, these
> are neither in blue color nor converting mouse pointer to hand when
> mouse is over them and not accepting mouse click to launch the URL
> under mouse pointer etc. This means that Textbox control is not
> capable of handling URLs and email addresses.

> We have also tried Richtextbox control but the same problem persists.
> Is there a control(preferably from VB standard controls) which can be
> used to display the text with URLs in enabled form.

> We also thought to get benefit from MS WORD using OLE concept, but in
> this case WORD must be opened within our application to give the
> impression that this is a part of our application. If you think this
> is feasible then can you please provide some example code to achieve
> this? Please note that we wish to open WORD in our own application
> instead of opening a separate instance of WORD.

> Thanks in advance.

> Faiz



Sun, 03 Apr 2005 21:57:10 GMT  
 URLs not enabled in Textbox control

Quote:
> Dear VB Gurus,

> In VB6 we are using a Textbox control to display some text. The text
> contains few links(URLs) and email addresses. The problem is that
> these URLs and email addresses are not enabled here. That is, these
> are neither in blue color nor converting mouse pointer to hand when
> mouse is over them and not accepting mouse click to launch the URL
> under mouse pointer etc. This means that Textbox control is not
> capable of handling URLs and email addresses.

> We have also tried Richtextbox control but the same problem persists.
> Is there a control(preferably from VB standard controls) which can be
> used to display the text with URLs in enabled form.

> We also thought to get benefit from MS WORD using OLE concept, but in
> this case WORD must be opened within our application to give the
> impression that this is a part of our application. If you think this
> is feasible then can you please provide some example code to achieve
> this? Please note that we wish to open WORD in our own application
> instead of opening a separate instance of WORD.

> Thanks in advance.

You can use a RichTextBox to simulate what you want. Consider this
kludge solution I posted previously for a slightly different, but
related, question. See if you can modify it to do what you need.

Rick - MVP

OK, here my kludge-of-week suggestion -- start a new project, put a
RichTextBox control on the form and paste this code into the Form's code
module.

Private Sub Form_Load()
  With RichTextBox1
    .Text = "In this test, the word test will be ""sensitive"" to
clicking."
    .Find " test"
    Do While .SelLength
      .SelColor = vbBlue
      SelectedLength = .SelLength
      .SelLength = 0
      .Find " test", .SelStart + SelectedLength
    Loop
    .SelStart = 0
  End With
End Sub

Private Sub RichTextBox1_Click()
  If RichTextBox1.SelColor = vbBlue Then MsgBox "I'm Blue!"
End Sub

The concept is to make the text you want to be "sensitive" to clicking a
different color from the normal black that text is. Then, simply test
the color of the character that the user clicks on. If it is that
different color, give the extra information to him, if it is not that
color, do nothing. The example above highlights the word "test" and
makes it blue (in the Form's Load event). In the click event, check if
the user clicked a blue character.

Now, since this is a kludge, there are some minor "issues" to attend to.
Note that the blank space in front of the word "test" was turned to blue
also (VB thinks it is; of course you can't see it). So clicking in front
of the first "t" in "test" will register as a hit. If the "sensitive"
word is the first word of the string, you may have to add extra code to
account for this (my quick-code implementation of the Find function is
for a blank space followed by the keyword). If the user cursors over the
text, nothing happens because no click took place. If you need this
functionality, you will have to check for arrow key presses in the
KeyDown event and take action there.

It's a kludge, but I think it does what you want -- and its
implementation is quite simple. Also, if you don't want to set the text
apart from its surrounding text, you could use

    .SelColor = RGB(1, 1, 1)

and test for RGB(1, 1, 1) in the Click event. This color is close enough
to black that the user should not be able to see it is different (unless
if they are using only 256 colors maybe), but the difference is more
than enough for the color testing.

Hope you found this interesting.

Rick



Sun, 03 Apr 2005 22:40:20 GMT  
 URLs not enabled in Textbox control
I wish to display the following text in the control.

******* Text starts from here *******************************

Welcome to the new release of abc software.  If you have not used this
before
we hope that you will find it to be useful in you daily work.

Enhancements to this release:

To know what's new in this release please visit the website

                http://www.abc.com

We look forward to get your valuable comments, suggestions and
queries:


******* Text ends here *******************************

Currently I am using textbox control, but the URL and the email
address is not enabled in this control. To convert the mouse pointer
into pointy hand is difficult because mouse_move event of Richtextbox
control is activated when mouse is over RichTextBox and it does not
care the text available in the control.

Another issue is that when user clicks on the URL/email how'll I have
to get the site/email address to launch the browser.

Regards,

Faiz

Quote:



> > Dear VB Gurus,

> > In VB6 we are using a Textbox control to display some text. The text
> > contains few links(URLs) and email addresses. The problem is that
> > these URLs and email addresses are not enabled here. That is, these
> > are neither in blue color nor converting mouse pointer to hand when
> > mouse is over them and not accepting mouse click to launch the URL
> > under mouse pointer etc. This means that Textbox control is not
> > capable of handling URLs and email addresses.

> > We have also tried Richtextbox control but the same problem persists.
> > Is there a control(preferably from VB standard controls) which can be
> > used to display the text with URLs in enabled form.

> > We also thought to get benefit from MS WORD using OLE concept, but in
> > this case WORD must be opened within our application to give the
> > impression that this is a part of our application. If you think this
> > is feasible then can you please provide some example code to achieve
> > this? Please note that we wish to open WORD in our own application
> > instead of opening a separate instance of WORD.

> > Thanks in advance.

> You can use a RichTextBox to simulate what you want. Consider this
> kludge solution I posted previously for a slightly different, but
> related, question. See if you can modify it to do what you need.

> Rick - MVP

> OK, here my kludge-of-week suggestion -- start a new project, put a
> RichTextBox control on the form and paste this code into the Form's code
> module.

> Private Sub Form_Load()
>   With RichTextBox1
>     .Text = "In this test, the word test will be ""sensitive"" to
> clicking."
>     .Find " test"
>     Do While .SelLength
>       .SelColor = vbBlue
>       SelectedLength = .SelLength
>       .SelLength = 0
>       .Find " test", .SelStart + SelectedLength
>     Loop
>     .SelStart = 0
>   End With
> End Sub

> Private Sub RichTextBox1_Click()
>   If RichTextBox1.SelColor = vbBlue Then MsgBox "I'm Blue!"
> End Sub

> The concept is to make the text you want to be "sensitive" to clicking a
> different color from the normal black that text is. Then, simply test
> the color of the character that the user clicks on. If it is that
> different color, give the extra information to him, if it is not that
> color, do nothing. The example above highlights the word "test" and
> makes it blue (in the Form's Load event). In the click event, check if
> the user clicked a blue character.

> Now, since this is a kludge, there are some minor "issues" to attend to.
> Note that the blank space in front of the word "test" was turned to blue
> also (VB thinks it is; of course you can't see it). So clicking in front
> of the first "t" in "test" will register as a hit. If the "sensitive"
> word is the first word of the string, you may have to add extra code to
> account for this (my quick-code implementation of the Find function is
> for a blank space followed by the keyword). If the user cursors over the
> text, nothing happens because no click took place. If you need this
> functionality, you will have to check for arrow key presses in the
> KeyDown event and take action there.

> It's a kludge, but I think it does what you want -- and its
> implementation is quite simple. Also, if you don't want to set the text
> apart from its surrounding text, you could use

>     .SelColor = RGB(1, 1, 1)

> and test for RGB(1, 1, 1) in the Click event. This color is close enough
> to black that the user should not be able to see it is different (unless
> if they are using only 256 colors maybe), but the difference is more
> than enough for the color testing.

> Hope you found this interesting.

> Rick



Mon, 04 Apr 2005 13:39:28 GMT  
 URLs not enabled in Textbox control

Quote:
> I wish to display the following text in the control.

Please do not multipost the same message to several groups.
If a question is relavant to more than one group, select the two or
three most relavant and crosspost to them only.  Replies to your
multiposted messages do not show up in the other groups, thereby
perhaps causing many to duplicate work already done, and those
in the other groups do not gain from any answers that might solve
the problem.

This reply has been crossposted to the Syntax group by adding
that group to the TO line, that is how you would crosspost your
original questions.  This and any replies under it will now be viewable
in both groups.  That allows everyone from both groups to see the
replies and contributte to the discussion.

Here is one method when you know IE 4 or higher will be installed.

In a new project go to Project>Components and add Microsoft
Internet Controls.  That will add the WebBrowser object to your
VB Toolbar.  Place that control on a new form.  Then go to
Project>References and check off Microsoft HTML Object Library.

Now paste the following code to the new form and try it out:

HTH
LFS

Option Explicit
' REQUIRED REFERENCES:
'    Microsoft HTML Object Library
'    Microsoft Internet Controls
' REQUIRED COMPONENT
'    Microsoft Internet Controls
'    (WebBrowser)

Private Sub Form_Load()
Dim Msg As String

  Msg = Msg & "<HTML><HEAD></HEAD><BODY>"
  Msg = Msg & "Welcome to the new release of ... <BR>"
  Msg = Msg & "<P>To know what's new in this release  ... <BR>"
  Msg = Msg & "<A HREF='http://www.google.com' TARGET='new'>www.google.com</A>"
  Msg = Msg & "<P>We look forward ...<BR>"

  Msg = Msg & "</BODY></HTML>"

  Show
  Document = Msg

End Sub

Private Sub Form_Resize()
  WebBrowser1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub

Public Property Get Document() As String
'Returns HTML document from Browser
Dim Doc As HTMLDocument

  If WebBrowser1.ReadyState = READYSTATE_COMPLETE Then
    Set Doc = WebBrowser1.Document
    If Not Doc Is Nothing Then
      Document = Doc.documentElement.innerHTML
      Set Doc = Nothing
    End If
  End If

End Property

Public Property Let Document(ByVal NewValue As String)
'Writes a new (text or HTML) document to Browser
Dim IDoc As IHTMLDocument

  On Error GoTo DocError
  WebBrowser1.Navigate2 "about:blank", 2
  DoEvents

  If Len(NewValue) Then
    Set IDoc = WebBrowser1.Document
    IDoc.open "text/html", "replace"
    IDoc.write NewValue
    IDoc.Close
    Set IDoc = Nothing
  End If
DocError:
End Property



Mon, 04 Apr 2005 15:18:45 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. enabled property of textbox control

2. Need help re: ADO Control on several forms not enabled

3. RichTextBox and Custom Links (Not URLs)

4. Change mouse icon when textbox enabled = false

5. Enabled property of textbox.

6. Enabling/Disabling textboxes in Validate Event

7. Enable text in TextBox

8. Textbox, Enable-Property, Graystyle

9. Help-- question re textbox enabled=false

10. TextBox forecolor/enable

11. Enable=False without dimming text in textbox

12. textbox enabling: single line printing

 

 
Powered by phpBB® Forum Software