Skip to content

Tools Property #179

Closed
Closed

Description

@itg-assistant

Cris asked 2016-07-25 13:57:09 UTC

Hi,

I've tested Tools property for TextBox and it looks great. Window/Forms will now be free from so many lookup buttons and it will be cleaner now. But can you make it visible only when the control has focus even if it's Visible property is set to true.

Should we expect the same feature in DataGridView  cell editor as per my opinion here: https://wisej.com/support/question/control-enhancements.

Am I asking for too much?

Thanks.

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-07-25 14:44:49 UTC

    Hi Cris,

    We can add a property to the tool to hide it when losing the focus. Will log it as an enhancement. It's easy to add.

    All the cell editors use the equivalent edit control. You can alteady add the tools if you override or attach the edit initialization event. I will add an enhancement to make the property Tools available for the applicable DGV cell classes.

    Best,
    Luca

  2. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Cris answered 2016-07-25 14:51:39 UTC

    Hi Luca,

    That's great. It seems that the framework is very flexible and it's always ready for an enhancement.

    Regards.

  3. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Tiago Freitas Leal answered 2016-08-26 09:15:25 UTC

    Hi Luca,

    There are 2 issues on this thread:

    • add a property to the tool to hide it when losing the focus - what's the status on this?

    • make the property Tools available for the applicable DGV cell classes - as far as I tested, this isn't ready (at least for DataGridViewTextBoxCell).

  4. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Alex Prinias answered 2016-08-26 10:05:08 UTC

    Hi guys,

    I'm trying to get a Tools in a Textbox, but as soon as I add a Tool to the tools collection, the form becomes invisible. What am I missing? Can you share a piece of implementation code? Below the code I'm using.

    Best,
    Alex

    .............................................

    var fOtherForm = new Form();
    fOtherForm.MdiParent = this;
    fOtherForm.Show();

    var text = new TextBox();
    text.Left = 100;
    text.Top = 100;
    fOtherForm.Controls.Add(text);

    var tools = new ComponentToolCollection(text);
    var tool = new ComponentTool();
    tool.Position = LeftRightAlignment.Left;
    tool.ToolTipText = "Push this to get magic!";

    // Up to here, the TextBox is visible in the form, after the following line I get an empty screen!

    tools.Add(tool);

    ............................

  5. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Tiago Freitas Leal answered 2016-08-26 10:33:39 UTC

    Hi Alex,

    I just used the designer and  to add componentTool1 Tool to txtAddress TextBox it generated the following code:

    Wisej.Web.ComponentTool componentTool1 = new Wisej.Web.ComponentTool();
    
    ...
    
    componentTool1.ImageSource = "tab-close";
    
    componentTool1.Name = "clear";
    
    componentTool1.ToolTipText = "ClearTextBox";
    
    this.txtAddress.Tools.AddRange(new Wisej.Web.ComponentTool[] {
    
    componentTool1});
    
    ...
    
    this.txtAddress.ToolClick += new System.EventHandler(this.txtAddress_ToolClick);
    

    and also the event handler

    private void txtAddress_ToolClick(object sender, EventArgs e)
    {
    txtAddress.Text = string.Empty;
    }
    
  6. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Tiago Freitas Leal answered 2016-08-26 11:34:48 UTC

    As per 2.1.40.0, replace

    System.EventHandler
    

    by 

    Wisej.Web.ToolClickEventHandler
    

    This same version introduces cell Tools. Use the designer and set the Tools on the relevant column. You must also set CellToolClick event handler.

  7. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-08-26 12:20:28 UTC

    Hi Tiago,

    The property to hide the tools when losing the focus is not there yet. It needs to be defined better.

    All DGV columns with editors that support tools have the Tools property and are all implemented.

    Best,

    Luca

  8. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-08-26 12:23:06 UTC

    Alex,

    One of the previous builds had a problem with tools that caused the creation of the widgets to stop.

    Best,

    Luca

  9. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Alex Prinias answered 2016-08-26 12:31:25 UTC

    Hi Tiago,

    Thanks for your answer. But I can't make it work. I do the same as the steps you mention, but in my code, not using the designer. As soon as I create the ComponentTool, i.e. uncomment the first of the commented out lines in the following, I get and empty screen....

    Thanks again.
    Alex

    public partial class Window7 : Form
    {
    public Window7()
    {
    InitializeComponent();

    var text = new TextBox();
    text.Left = 100;
    text.Top = 100;
    this.Controls.Add(text);

    //var tool = new ComponentTool();
    //tool.Position = LeftRightAlignment.Left;
    //tool.ImageSource = "tab-close";
    //tool.ToolTipText = "Push this to get magic!";
    //text.Tools.Add(tool);
    }
    }

  10. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Tiago Freitas Leal answered 2016-08-26 14:56:30 UTC

    Hi Alex.

    There's nothing wrong with your code. I tryed it on my own project (copy&paste) and it runs all right. So... other than suggesting a computer restart :), I can't help you.

  11. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Alex Prinias answered 2016-08-26 16:15:24 UTC

    Dear Tiago,

    I didn't need to restart! In fact, after updating to the latest wisej version (1.2.40), my tools showed up.

    Many thanks for your help.

    Alex

  12. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Alex Prinias answered 2016-08-26 16:19:35 UTC

    Dear Tiago,

    By the way, I was wondering how come you are the only one with a picture next to your name... Have I missed some registration procedure?

    Best,
    Alex

  13. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Tiago Freitas Leal answered 2016-08-26 16:27:02 UTC

    I don't know why I have my picture  here. There is no registration at all. I use my Gmail address on all comments. I guess my pivture comes my Gmail account..

  14. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-08-26 16:34:49 UTC

    Wisej has taken control of your pc camera. :)

    Wordpress and other CMS read the gravatar from gravatar.com, which in turn probably loads them from various providers. Your gravatar is the md5 hash of your email address:

    http://2.gravatar.com/avatar/ef0ce49f10322041268292d4c74952ba"

    https://en.gravatar.com/site/implement/hash/

    If you set up a profile image in gmail it will be used by all sites reading gravatars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions