komorra / NodeEditorWinforms

Node based user control / editor for Windows Forms
MIT License
514 stars 144 forks source link

Custom editor help #14

Open midikidi opened 3 years ago

midikidi commented 3 years ago

Fantastic project thankyou for sharing your code) please help me .

PVE4 FE NODE EDIOR (screen shot) Example parameter module shows a slider and a combo box how can this be acheived or otjer multiple components is it possible for an example how to change code below ?

[Node("IsGreater",customEditor:typeof(NumericUpDown))] public void IsGreater(int input, out bool output) { var userThreshold = (int)(CurrentProcessingNode.CustomEditor as NumericUpDown).Value; output = input > userThreshold; }

komorra commented 3 years ago

If I understood you correctly, do you mean to change that code you've posted for usage of slider or combo box? for example to read value of slider in the node body?

midikidi commented 3 years ago

I have created custom combo box, list box,text box,checkbox and trackbar no problem. I can read and write to these custom nodes. But I saw in a screenshot of PVE4 FE NODE EDITOR you created a node with 2 custom controls, I want to create a custom node with a combo box and a trackbar together in same node example

komorra commented 3 years ago

Ah I see. Well, to do this, you must first create a custom user control in winforms that is empty (let's name it MyCustomControl for now). Now you must insert into MyCustomControl one trackbar and one combobox in the places that fits your needs, and add custom code to retrieving or setting their values in MyCustomControl. The final step, when MyCustomControl is finished and working, is to use it as a custom editor for node. This is exactly what I'm doing on screenshot. Hope this helps.

midikidi commented 3 years ago

Great got it sorted 3 controls in a user defined form and getting values just need to implement set. there is a minor issue if i load my custom node it appears ok, I have matched the background color but if i click on the orange bar at the top of the node the whole node is not repainted loaded box clicked on node orange bar

midikidi commented 3 years ago

Im curious I work with Devexpress for winforms I will see if those components work

midikidi commented 3 years ago

Problem resolved made user form transparent