Page 2 of 2 FirstFirst 12
Results 41 to 65 of 65

Thread: Label control that supports hyperlinks, different colors and font styles

  1. #41
    Member
    Join Date
    Sep 2011
    Posts
    56

    Re: Label control that supports hyperlinks, different colors and font styles

    I have it sorted.

    I ended up doing the center alignment at runtime in the form that uses the hyperlabel as try as I might, I cannot get my head around how to align what nothing within something as I have never done an ocx custom control.
    Last edited by bitman; Sep 23rd, 2011 at 02:52 PM.

  2. #42
    Member
    Join Date
    Sep 2011
    Posts
    56

    Re: Label control that supports hyperlinks, different colors and font styles

    Hi Joacim,

    Long time no pester!

    I finished my form with hyperlabels in it.
    The form is compiled down to an ActiveX exe file.
    It has worked like a charm on the xp32 development machine but when I installed it on a fresh xp32 box the .exe object would not create. CoCreateInstance was returning Unknown Facility of all things but would show up in task manager.

    This Activex exe when previous to it's hyperlabel upgrade been portable with no dependencies. After chasing the problem for days with no change, I replaced the ActiveX exe with one from the day before hyperlabel. This version has plain vanilla labels where the hyperlabels are on the non portable one.

    And it runs. CoCreateInstance returns S_OK

    While I know this doesn't mean that hyperlabel is the culprit, I thought I would see if you had any insight.

    Btw. I have tried hand registering hyperlbl.ocx on the target box but it's did not change things.

    Thanks.

    :Ron Anderson

  3. #43

    Thread Starter
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Label control that supports hyperlinks, different colors and font styles

    Instead of compiling the label to an ocx, just add the source code files to your project.

  4. #44
    Member
    Join Date
    Sep 2011
    Posts
    56

    Re: Label control that supports hyperlinks, different colors and font styles

    Firstly Joacim, thank you for watching this old thread.

    I found out that my problem had nothing to do with hyperlabel but did try to include the source files into my project anyway. I added the Hyperlink.cls file to the classes folder and adding the Hyperlabel.ctl created the expected user control folder with it inside. It compiles to a size that reflects the addition of the hyperlink code alright, but if I place that compiled activex exe on a virgin machine it runs but spits out an vb error 339 that hyperlbl.ocx is not registered or it's dependency is missing. Placing hyperlbl.ocx on the offending machine and registering it takes care of the problem but tells me I am not doing something correct at the first.

    Any ideas?

    Thanks again.
    :Ron Anderson
    Last edited by bitman; Nov 7th, 2011 at 02:31 PM.

  5. #45

    Thread Starter
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Label control that supports hyperlinks, different colors and font styles

    The labels you have on the Form is probably not from the source you added to the project but from the earlier compiled OCX. You need to recreate these and remove the reference you have to the OCX file.

  6. #46
    Member
    Join Date
    Sep 2011
    Posts
    56

    Re: Label control that supports hyperlinks, different colors and font styles

    I was afraid of that.

    Thanks.

  7. #47
    New Member
    Join Date
    Dec 2011
    Location
    USA
    Posts
    9

    Question Re: Label control that supports hyperlinks, different colors and font styles

    Quote Originally Posted by Joacim Andersson View Post
    It doesn't have property pages but you can still set all the properties during design time in the property window (press the F4 key if you don't see it).
    So glad this thread isn't dead!. I have VB5 [waits for laughter to stop...] , have made most VB6 code samples work in VB5, but never worked with making controls until I had to compile the OCX for HyperLabel. It works and really is a great item. I am using Hyperlabel to colorize output from a Folder Watcher program (red for Deletes, green for Adds, blue for Renames, etc in a long string separated by vbCrLf) . I can have it autoresize when the main form is resized, but the visible output is basically limited to the vertical size of the user's screen. It screams out for Scrollbars. I did find something at VBAccellerator that can actually add Scrollbars to forms and controls, even buttons, but Hyperlabel however does not have the required ".hwnd" property. My question is how can I get the .HWND property without using an external app like FindWind.exe. (I assume the Handle could change) I got linked back here searching the internet this morning for How to find the handle of a window or control and just downloaded your other program FindWind.

    Tony

  8. #48

    Thread Starter
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Label control that supports hyperlinks, different colors and font styles

    You can easily add a read-only hWnd property to the source.
    Code:
    Public Property Get hWnd() As Integer
        hWnd = UserControl.hWnd
    End Property

  9. #49
    New Member
    Join Date
    Dec 2011
    Location
    USA
    Posts
    9

    Re: Label control that supports hyperlinks, different colors and font styles

    Thanks for the fast reply! I will try that this week!

  10. #50
    New Member
    Join Date
    Dec 2011
    Location
    USA
    Posts
    9

    Re: Label control that supports hyperlinks, different colors and font styles

    Thanks for the fast reply! I will try that this week!
    =========== reply delayed 2 weeks ==============
    Finally added .HWND property. Needed "As Long" like other HWND references, and I ended up giving the OCX a different name. The VB5 IDE and underlying Windows had to have all OCX and OCA references renamed or removed after each attempt. Now I have scrollbars on Hyperlabel and cannot get them to function. I haven't figured out the code the scrollbars need to go thru the Hyperlabel contents. It is basically a long string with each line separated by vbCrLf. The example I saw at VBAccellerator.com didn't have label control, just picturebox and form, so I'm wondering if I have to add something else ( 'way over head now). Hyperlabel1 gets resized when the Form gets resized; that still works. I'm lnow ooking at your re-write of Labelscroller next as a sample to try to get Hyperlabel1.Caption to scroll thru a string.

    In checking the old VB5 reference books, it mentions regular Label.Caption can hold only 1024 characters. I need to check Hyperlabel.Caption's capacity. It occurs to me now after an intense few days, that if output will require periodic 'dumping' of data to a file anyway, maybe scrolling shouldn't be that important. Thanks again, I appreciate your help.

  11. #51
    New Member
    Join Date
    Dec 2011
    Location
    USA
    Posts
    9

    Re: Label control that supports hyperlinks, different colors and font styles

    I stopped counting at 5000 chars for .Caption. So that should be plenty.

  12. #52

    Thread Starter
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Label control that supports hyperlinks, different colors and font styles

    The HyperLabel doesn't really have a limit on the Caption property as long as the process has memory you could (at least in theory) have as much text as you want (it will probably be terribly slow to process if you get over 64KB of text or so). But in theory you could have close to 2GB of text.

  13. #53
    New Member
    Join Date
    Dec 2011
    Location
    USA
    Posts
    9

    Re: Label control that supports hyperlinks, different colors and font styles

    (lack of ) progress report. Tried 4 different things.
    1) compared original LabelScrol code and tried "interpolating" and combining. Gave up. It's a mess.
    2) Downloaded the Labellscroller you had modified. The names in many cases matched those in Hyperlabel and I tried copying relevant Labelscroller sections into HyperlabelWell, and after a few versions it compiles to an OCX without errors but none of the scrollbars actually MOVE the Hyperlabel contents up/down. In fact none of them show the "thumb" (??the square in the middle of the scrollbars you grab.
    3) the HWND property is now there in Hyperlabel and I can add the VBAccellerator.com CLS file and actually get scrollbars WITH a thumb. But nothing I have tried since then can get the Hyperlabel.Caption to scroll up or down. Their examples add scrollbars to Form; nothing about controls except picturebox. I don't want to try that as it doesn't 'seem' (what do I know?) to be what I am trying to do.
    4) [the easiest] I rearranged the .Caption to always show the latest line of Hyperlabel output at the top. This way I can at least see the 30-40 lines that are most recent. That was the OutOfBox solution that occured to me after a long walk.

    Still trying... In my many many internet searches, I have run across many references to "Hyperlabel" and people trying to sell Hyperlabel as shareware by the way.

  14. #54
    New Member
    Join Date
    Dec 2011
    Location
    USA
    Posts
    9

    Re: Label control that supports hyperlinks, different colors and font styles

    For about a month, I've been trying to add VScrollbar to Hyperlabel and finally got it. I had gone back to # 2) in a previous msg, giving another try to adapting LabelScroller to HyperLabel. This time instead of adding LabelScroller code TO Hyperlabel, I deleted Label1 (a VB control) from LabelScroller and replaced it with HyperLabel.ctl, changing very little except references to lblMessage. Finally 1003AM 1/4/12 I got some RED text in HyperScroller, along with Vertical scrolling! Doesn't need Horizontal, due to word wrapping.

    I am trying to upload a ZIP file with VB5 code used but not the EXE per Forum rules. this is just a demo Project showing that it works.


    1) To make HyperScroller, I had to delete the Sub oForm_MouseMove from Hyperlabel. I forget the exact error but it occurs in my VB5 IDE when LOADING the HyperLabel.ctl into the Project. Later testing (not tested in the demo) in my app shows that the URL BB code in HyperLabel works, except
    there is no "finger icon" when you hover over the URL. Don't know how to fix this. Not sure how important it is; not for my purposes. I tried moving the Sub from Hyperlabel.ctl to HyperScroller.ctl as a total guess, but didn't work either.

    2) hyperlabel.plaincaption does not work in my app. I did not test this in the demo app either, as my last months daily task has been to get my app scrolling with color. I don't know much, but it seems like the m_sPlainCaption variable is not "exposed" where I can use it from my app. If I use Hyperlabel1.PlainCaption in my app, the error is undefined variable. if I use HyperScroller.PlainCaption the error is no such Member.

    Again, HyperScroller contains HyperLabel; you need both controls, plus the CHyperlink class in your app. I will have to find a way to manually strip out the brackets and characters inside the brackets.

    odd thing: later, when trying to run ActiveX wizard on hyperscroller.ctl (a second time. worked okay first time) get 2 consistent errors: runtime error 5, then automation error 440, then VB5 IDE locks up. It doesn't do this with hyperlabel.ctl, just hyperscroller.ct. Control itself works. I may have broken something in my wizard.

    That's my first and probably last major effort at trying to modify Controls. Source code for controls on the internet is very hard to come by.
    If there was source code for TextBox, might have been easier to add the BB tags there?

    Thanks Joacim for a great control and giving us the source!
    Attached Files Attached Files

  15. #55
    New Member
    Join Date
    Dec 2011
    Location
    USA
    Posts
    9

    Re: Label control that supports hyperlinks, different colors and font styles

    If you read this far, in your main Form1, this would take the place of .PlainCaption, stripping BBtags from the .Caption. I did not test this in the uploaded demo Project, but in my other Project I needed this:

    Private Sub cmdNoTags_Click()
    Dim txt As String
    'I think .plaincaption has to be 'exported' to hyperscroller.
    'txt = HyperScroller1.PlainCaption 'error: Method or data member not found
    'txt = HyperScroller1.PlainCaption 'error: Variable not define
    'can't compile to EXE, can't save output without BBtags like I used to:
    'txt = HyperLabel1.PlainCaption
    ' WriteFile App.Path & "\filemon.dat", txt

    'This would be equivalent of hyperlabel1.plaincaption:

    'NOT as it would be difficult and will NOT be a folder name
    'NOT [][*] as italic too hard to read. won't be any lists.
    txt = HyperScroller1.Caption 'save a copy, operate on the copy
    txt = Replace(txt, "[color=black]", "")
    txt = Replace(txt, "", "")
    txt = Replace(txt, "
    ", "")
    txt = Replace(txt, "[color=#0A9C02]", "") 'dark green
    txt = Replace(txt, "[color=red]", "")
    txt = Replace(txt, "[color=blue]", "")
    'test document used magenta, cyan, and green too. white and yellow not likely foreground colors
    txt = Replace(txt, "[color=magenta]", "")
    txt = Replace(txt, "[color=cyan]", "")
    txt = Replace(txt, "", "")
    'so far didn't use underline
    txt = Replace(txt, "", "")
    txt = Replace(txt, "
    ", "")
    'didn't use the following, but you never know
    txt = Replace(txt, "
    ", "")
    WriteFile App.Path & "\filemon.dat", txt

    VB6 has a builtin Replace function. You have to add it to VB5 yourself.
    Last edited by Tony4219; Jan 5th, 2012 at 04:27 PM. Reason: I think the website is reading [b] and [/b] tags

  16. #56
    Member
    Join Date
    Sep 2011
    Posts
    56

    Re: Label control that supports hyperlinks, different colors and font styles

    HyperlabelClick or yet unsupported "disable"?

    I love hyperlabel. What a great thing it is.

    As is well known, with standard vb6 labels, one can implement click through on the labels by setting the label to disabled. It is also well known that without some serious hoop jumping, that disabled label is forever gray. But this permits the right click and left click to be fired on the underlying form.

    I hoped that hyperlabel would provide the best of both worlds, that is color yet click through but hyperlabel has no enable feature.

    Is it possible without great pain to implement .enable?

    I havn't got the HyperlableClick to work yet on a vast array of hyperlabels, so as to move the form or pop up a menu in response to right and laft click of that arrayed hyperlabel.

    But I'll keep trying.

    :Ron

  17. #57
    Member
    Join Date
    Apr 2009
    Posts
    57

    Re: Label control that supports hyperlinks, different colors and font styles

    Is there a control like this for vb.net? Please let me know, I've been looking everywhere.

  18. #58
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Label control that supports hyperlinks, different colors and font styles

    Quote Originally Posted by babyjesus View Post
    Is there a control like this for vb.net? Please let me know, I've been looking everywhere.
    Did you look in the VB.NET codebank?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  19. #59
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    353

    Re: Label control that supports hyperlinks, different colors and font styles

    I tried to search for the .NET equivalent class, someone needs to port this. Can make life a heck of a lot easier.

  20. #60
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Label control that supports hyperlinks, different colors and font styles

    Quote Originally Posted by Nightwalker83 View Post
    Did you look in the VB.NET codebank?
    To be fair the CodeBank isn't organized enough for a search for something this specific to be effective.

    @babyjesus

    Is there something specific about this HyperLabel that you like ? I haven't tried it so I don't know. Perhaps I could replicate whatever it is about it that everyone loves in a VB.Net version. A direct port from VB6 to VB.Net is an exercise in frustration if the code is not simple enough.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  21. #61
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    353

    Re: Label control that supports hyperlinks, different colors and font styles

    What I like about it personally is how you can format everything in a similar fashion as BB code so you could have one single label but make certain words a certain color, underlined, bold, italic, etc... vs having to have two three labels to achieve a similar effect.

    For example when I'm querying AD, I have one label for what it is and one label for result. I could have a single label and have the first part what it is in bold and the second part just plain text (for example).

    Any number of other such situations.

    The same could be said about a custom msgbox if it could do this

    where you can use simple forum style code formatting in a string that gets parsed.

    Code:
    "Is online: Offline" & vbcrlf & _
    "Is mez onlinez Online!" & vbcrlf & _
    "Underlinez meeee"
    Soimething like that like this hyperlabel does.

    Edit: lol that didn't workout so well.. didn't display BB codes.. it actually just showed the output haha...

    Speaking of which I notice some people use code block with color coded VB code.. is there a hidden BB code on this forum for that or ... did those people actually take the time to color code the code >_>

  22. #62
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Label control that supports hyperlinks, different colors and font styles

    Quote Originally Posted by a_ahmed View Post
    What I like about it personally is how you can format everything in a similar fashion as BB code so you could have one single label but make certain words a certain color, underlined, bold, italic, etc...
    I actually wrote something like this about a year ago but its not complete.

    Quote Originally Posted by a_ahmed View Post
    Speaking of which I notice some people use code block with color coded VB code.. is there a hidden BB code on this forum for that or ... did those people actually take the time to color code the code >_>
    You're talking about highlight tags. This:-

    [HIGHLIGHT=vbnet]

    Dim a As Integer

    [/HIGHLIGHT]

    Gives you this:-
    vbnet Code:
    1. Dim a As Integer
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  23. #63
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    353

    Re: Label control that supports hyperlinks, different colors and font styles

    Quote Originally Posted by Niya View Post
    I actually wrote something like this about a year ago but its not complete.
    Ah I hope you get it done, this would be wicked cool for labels and msgbox!

    You're talking about highlight tags. This:-

    [HIGHLIGHT=vbnet]

    Dim a As Integer

    [/HIGHLIGHT]

    Gives you this:-
    vbnet Code:
    1. Dim a As Integer
    Oh I did't know that, wicked! Too cool! I need that on my myBB forum lol. This is a vBulletin forum though right? Just did a quick google and found this: http://www.infernodevelopment.com/bb...x-highlighting will have to investigate!

  24. #64
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Label control that supports hyperlinks, different colors and font styles

    Quote Originally Posted by a_ahmed View Post
    Ah I hope you get it done, this would be wicked cool for labels and msgbox!
    Yea, I'll see if I can pick up where I left off. Just have to find it first lol.

    Quote Originally Posted by a_ahmed View Post
    This is a vBulletin forum though right?
    Yep. Though I believe the highlight tags are custom made specifically for this forum. I wouldn't expect them to work at say Stormfront.org which also runs vBulletin.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  25. #65
    Junior Member
    Join Date
    Jul 2016
    Posts
    28

    Re: Label control that supports hyperlinks, different colors and font styles

    Implementing the mouse wheel to this label will make it easier to scroll.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width