Jump to content

Outputting text into a property field


Modus Ponens

Recommended Posts

I'm trying to write a plugin that analyzes the pixels and extracts some data from them, and then reports that data somehow. For the sake of discussion, let's just say that I want to calculate the average color of all the pixels and then show the name of that color in English. (This isn't actually what I want my plugin to do, but it's easier to explain.) Ideally, when you select the plugin from the Effects menu, the effect dialog would open and it would have a "Run" button or something. Clicking that button would run the analysis and output the color name into a text field in the effect dialog. I know neither how to make the button nor how to update the text shown in a text field in the effect dialog. Are these things that can be done with a CodeLab plugin?

 

Here's a mock-up of what I'm talking about. Note that there's no "OK" button, since this plugin doesn't actually do anything to any pixels in the image; I definitely don't mind having an OK button in addition to the Run button, if I can't get rid of it, but it's not necessary for what I'm trying to do.

image.png.9e47c63ed6971c043d583303b2cbaf1c.png

Link to comment
Share on other sites

3 minutes ago, Modus Ponens said:

Are these things that can be done with a CodeLab plugin?

 

No. You'll need to make a custom WinForms dialog if you want to do that kind of stuff.

 

Luckily, there are templates available:

https://forums.getpaint.net/topic/115325-project-templates-for-visual-studio/

  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

Excellent, thanks so much. In the post you linked me to, you listed six plugin types. Based on what I have described, can you recommend which of these I should use? I don't really know what all of them are, but I kind of have the vague intuition that I'm making a "PropertyBasedEffect" (the plugin I actually want to make does have two integer properties it will use in its computation).

Link to comment
Share on other sites

For your case, I suggest using the one simply labeled "Effect". It's a custom Winforms template that allows you to use the Winforms Designer in Visual Studio.

"PropertyBasedEffect" is what CodeLab would generate for you, and thus, would not be appropriate.

  • Upvote 2

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

I am planning on sharing it, but thanks for the suggestion.

 

Now I just need to figure out why Windows Form Designer is so heinously busted.

Link to comment
Share on other sites

 

36 minutes ago, Modus Ponens said:

Now I just need to figure out why Windows Form Designer is so heinously busted.

 

I too have issues with the designer. Here's what I can suggest:

  • Put the designer window on your primary monitor if using more than one.
  • Reset the system DPI scaling to 100%
  • Delete the OBJ folder for the project prior to (re)building it.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...