Results 1 to 14 of 14

Thread: Buttons design and caption

  1. #1

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    272

    Buttons design and caption

    Hi friends

    I search to change buttons (Command) design as well as original :
    - Has no ForeColor setting
    - Unchangeable 3D border color (A &H00404040& BackColor button on a same backcolor form reveals an aggressive clear greyed 3D border)

    I found the Chameleon user control library, that rids off the agressive clear greyed 3D border of original, for a 3D border color related with backcolor. The button looks very more natural.
    Problem : It's caption is only on one line, even if the texte is longer than the button width. (Original VB6 buttons automaticaly split the text on multiple lines). Also, I cannot manually split caption with vbCrLf of Chr(13) (plus, both has no effect) as well as the text of caption are user related (filename without extension, or user language for some button function names)

    I built a small project (cham.zip joined with this message) to show the problem.

    I didn't find but perhaps wrongly searched, but is it possible to enable automatic split and line feed for Chameleon buttons ? Or perhaps a way to modifay in the ctl file ? I saw a lot of code but I don't know at all where I can enable this, in case of it is possible.


    I spent several hours to search some other custom buttons but no chance, it never entielry match to what I would have.

    I found the librayry of LaVolpe https://www.vbforums.com/showthread....ntrol-(latest) , autosplit is OK but still have the clear greyed 3D border

    Any idea ?
    Thanks



    Edit :
    I found a workaround (darkShade and liteShade values) to change the 3D border color in the LaVolpe's library, but making exe is impossible, Avira directly deletes the exe file and lock the folder of the project.
    I tried without any modification (so directly from unzipped archive), same thing.

    Edit 2 :
    I built a small project of what I would have. I can get it with LaVolpe's library (I removed unused buttons an redraws) but I can't compile it
    Attached Files Attached Files
    Last edited by Couin; Sep 28th, 2022 at 10:36 PM.
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  2. #2
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Buttons design and caption

    Well, turn off Avira and find a better antivirus tool. Alternatively, set an exclusion on the project folder.

    Instead of buttons you can use picture controls and create your own buttons graphically using Photoshop or similar, then drop the picture of the button in its place on the picbox. You can pop a label or similar in the picture box, make it transparent and have some code handle the text in the manner you desire.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  3. #3

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    272

    Re: Buttons design and caption

    Hi yereverluvinuncleber,

    Thanks for your answer

    I don not plan to replace antivirus as well as it is for an app that I distribute so I would prefer building an exe that wo'n't be deleted for other people.

    Also, I can not replace the button for a picture as well as :
    - Buttons are resizable, a picture will result to a bad displaying of 3D border when stretching the image.
    - User can change the button color so with an image, he won't (I admit that I forget to notice this previously, as well as I would keep a button instead of image).
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  4. #4
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Buttons design and caption

    All new VB6 programs run the risk of being flagged as a virus by one a/v tool or another. Just use virustotal to determine in advance which sees your exe as a threat. Then it is YOUR job to flag it as a false positive to the a/v tool creator. Do this when you have something deliverable to your clients. If your a/v tool is a bit 'thick' then use another to avoid the daily problem or set an exclusion as stated before. This is basic stuff for all developers.

    If you allow the users to resize the form but not the buttons then you could use a picbox with a single sized image. If you really need to resize a button and want a background image to retain some borders and styling in the right place then that is also possible. You could have several images of different sized buttons and then load each at requirement using loadPicture. Restrict the button to five or six set sizes. That is do-able.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  5. #5
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,470

    Re: Buttons design and caption

    See if this thread is close to what you are after:

    https://www.vbforums.com/showthread....Command-Button

    J.A. Coutts

  6. #6

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    272

    Re: Buttons design and caption

    Hi friends

    I was forgetting, I also use OLEDragDrop on some buttons, to assign a file to them. This events does not work either on Chameleon and LaVolpe's buttons
    About picture, not possible, need user can change the color on some buttons.

    About MACButton , I checked and I did not saw OLEDragDrop evetn too, I think these buttons won't match with needings.
    Plus, the design looks funny (I'm not an Apple fan lol) but won't match with the app (jingle palette) that is looking more as a audio device

    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  7. #7
    Frenzied Member
    Join Date
    Jun 2012
    Location
    Australia
    Posts
    1,162

    Re: Buttons design and caption

    [QUOTE=yereverluvinuncleber;5581747]Then it is YOUR job to flag it as a false positive to the a/v tool creator.

    In TotalAV you set the vb program as an exception.
    Last edited by el84; Oct 9th, 2022 at 11:22 PM.
    Thanks all !

  8. #8
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Buttons design and caption

    Quote Originally Posted by Couin View Post
    I also use OLEDragDrop on some buttons, to assign a file to them.
    About picture, not possible,
    Why doesn't an OLEDragDrop work on a picbox? I think you may be wrong. I am sure it does.

    Quote Originally Posted by Couin View Post
    need user can change the color on some buttons.
    You could obviously restrict the choice to a suite of colours and provide those as images. I think that perhaps you should rethink your requirements, find another method - or find another language (perhaps VB.NET) to implement them.

    Someone else will have to help you from this point.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  9. #9

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    272

    Re: Buttons design and caption

    Quote Originally Posted by yereverluvinuncleber View Post
    Why doesn't an OLEDragDrop work on a picbox?
    It's not about OLEDragDrop that I was talking for picture, but just about picture metho to replace a button (Command/Graphical Checkbox). It's not what I search for.

    I just search a control like Chameleon or LaVolpe button, that have:
    - A 3D border color related with the backcolor instead of this stupid grey of original VB6 Command
    - Caption written on multiple lines if longer than button width (Like original VB6 Command)
    - OLEDragDrop (I catch the path of the file dropped on the button) (Like original VB6 Command)
    - BackColor changeable (programmaticaly) (Like original VB6 Command) AND ForeColor changeable (programmaticaly) (Like original VB6 Graphical CheckBoxes but not Command - I do'nt understand why one and not the other))
    - No needing to add A/V exception

    If I was able to add multilines and OLEDragDrop on Chameleon , it would be perfect, but the code of these buttons is enough hard to loose me AHAH

    I found "isButton" from "Fred" but No OLEDragDrop

    I'm pretty sure that someone has already created a control like that, but did not found yet

    Rewritting all the software in another language is not conceivable

    Thanks
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  10. #10
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Buttons design and caption

    Quote Originally Posted by Couin View Post
    If I was able to add multilines and OLEDragDrop on Chameleon , it would be perfect
    If you have the source for that control, it's not that hard...

    Just go into the "Source-View" (CodeEditor-Mode) of that UserControl.

    Then choose "UserControl" in the TopLeft-DropDown-Box.
    Then choose "the missing Event" in the TopRight-DropDown-Box -
    and the IDE will automatically generate the EventHandler for you, as e.g.:
    Code:
    Private Sub UserControl_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
      'still missing: a RaiseEvent-line below, to delegate (re-raise) the Event to the outside of the UC
    End Sub
    Now, copy the first line of the Event-Handler (its "Procedure-Signature") to the Top of the UCs CodeModule
    (somewhere into its "Declaration-Section", below Option Explicit).
    And replace the left part of the Signature-Line up to the Underscore-Char -
    with the word: Event (followed by a Space-Char), so that you end up with the line:
    Code:
    Event OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    Rinse and repeat for all additional Events you want to expose on the outside.

    Final step, don't forget the "Re-Raising" of these internal Events to the outside:
    - via RaiseEvent <EventName>(Parameters in the exact order as in the Handler-Def, but without Types of course)

    And that's it - a 5 minute-job...

    Olaf

  11. #11
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Buttons design and caption

    if u dont like the button, create one your own. how hard can that be?
    its simple math and rendering. and u can pick any kind of button style.
    just use a picturebox and use bitblt or alphablend.

  12. #12
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Buttons design and caption

    well. I have my solutions that works. graphical. using pictureboxes.
    what have u?
    just talk but nothing to show that actually works and it looks nice.

    people need to experience that on their own. create their own solutions and not always steal from others.

  13. #13
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: Buttons design and caption

    Just used Olaf's approach to add OLE drag&drop support to this button control based on 9-patch images (as used on Android) for the button state so hover, pressed, etc. can have different images.

    It's a windowless (lightweight) control so might feel different to standard CommandButton at first. We are using this control for our touch keyboard impl too.

    cheers,
    </wqw>

  14. #14

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    272

    Re: Buttons design and caption

    Hi friends,

    Sorry for delay, was a little bit busy during theses last times ...

    @Schmidt:
    Thanks for help
    With your message and some code from LaVolpe button, I managed adding the OLEDragDrop event, so now, dragging a file on the button (in exe mode, not in IDE running mode, of course) can reveal the filepath. Good point
    Just missing the caption problem (not displayed on multiple lines if the caption value is longer than button width).
    I'm not against some help if you have an idea
    I join the project here, in case of needing to see the actual result.

    @baka:
    Using pictures does not match with project requierments.
    Steal to others ? Hu ? I think I don't steal nothing as well as ressources authors releases them on the Internet

    @wqweto:
    Thanks for your links, I saved your project. It won't match with mine but it will probably useful for another app I have in the brain
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

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