NeoMorph
August 23rd, 2007, 01:08 AM
One of my complaints about NetRemote is that the example ccf's don't have enough comments in them and too many elements have default names. Well I thought instead of complaining I would do something about it and began to go through the mce1024x768 example and adding comments in when I realised what would be an excellent addition for coders.
How about a short single line comment attached to elements for use in the left hand tree and a larger comments tab for when you open the F2 properties!
I was a coder for quite a few years and when I went through training back in the 70's I was taught to add comments as most likely even though I wrote a program myself that after a couple of years even though I wrote it myself I would forget the reason for doing something in that program and it would make any alterations and/or additions more time consuming because I would have to take take extra time trying to learn the code and why I did certain things before I did the new work. Commenting code lets you quickly learn what certain code is and shortens familiarisation time and helps others who may be required to do work with your code become familiar too.
The comments boxes would allow you to put explanations for what the button or frame does. One of the really confusing parts of the NetRemote learning process I found was discovering what the actual elements do in the example ccf's.
For example the slider button component starts off as a basic button before being changed on the Position/Advanced tab... then it looks like a frame element but with an up/down image. I banged my head on the wall several times before I figured that it starts off as a button and not a frame. Once I realised to look for the dual button up/down states at the bottom I then got confused as to where the lua that controlled the slider was as it wasn't connected to the slider. I didn't know what to look for in the help file and so the examples I found didn't help me. Having a comment box explaining the use of sliders would have helped greatly.
Here is what I would have put on an example slider tutorial.
This slider button is configured on the Position/Advanced tab. The "Component" dropdown box shows it is a slider button by displaying "NRBasic:Slider Thumb Component" and the "Set Properties" button next to it allows you to set the variable (VAR) which is controlled by the slider, the starting position of the slider (STARTVALUE), the minimum slider value returned (MIN) and the maximum slider value returned (MAX). It also allows you to choose whether to send the value only when you release the slider button or continuously (OPTIONS: Send on release only) and also the frequency the slider value is sent using the THROTTLE value.
Some sliders control inbuilt NetRemote parameters (like here MP.GAC[8].CurrentPage which controls the page of album or artist results) and others control values that are defined and monitored in Lua programming using NetRemote.RegisterVariableWatch commands (which will be described in the relevant custom slider button). In this case where the value you want to use is a NetRemote parameter the MIN value should be set to 1 and the MAX value should be set to 1000. The actual values will be set by the NetRemote parameter itself by making itself a ratio of 1000...
For this example moving the slider if there are only 2 pages of results will work as follows...
If the value returned by the slider is between 1 and 500 it will show page 1.
If the value returned by the slider is between 501 and 1000 it will show page 2.
For this example moving the slider if there are only 3 pages of results will work as follows...
If the value returned by the slider is between 1 and 333 it will show page 1.
If the value returned by the slider is between 334 and 666 it will show page 2.
If the value returned by the slider is between 667 and 1000 it will show page 3.
If the above comments was in a Comments box or tab it would have helped me grasp the idea of sliders a lot quicker. Currently it means looking at the ccf and then having to search through the help files and trying to figure out how the heck the thing manages to control the page - it took me a couple of days because of having to figure out that the missing actions page didn't mean it was an element that did nothing. I was actually trying to figure out why the slider frame did nothing would you believe. DOH! :rolleyes: I then spent ages looking through the main Lua for the NetRemote.RegisterWatch that was called by the above slider... and obviously failed to find it because the above slider controlled the NR parameter directly. Hence the screaming need for comments... to stop new users screaming at NR that is ;)
Edit: If you do add the comments boxes I would be willing to volunteer to add comments to mce1024x768.ccf for all the stuff I've learned recently through blood, sweat and loads of tears... Hopefully my recent experience learning NRD coding will come to good use helping new users. I still have a ways to go but am gaining ground but so unfortunately my avatars "ODNAQA" will still be in effect for quite a while yet (that's "Oh Darn, NeoMorph's Asking Questions Again")
How about a short single line comment attached to elements for use in the left hand tree and a larger comments tab for when you open the F2 properties!
I was a coder for quite a few years and when I went through training back in the 70's I was taught to add comments as most likely even though I wrote a program myself that after a couple of years even though I wrote it myself I would forget the reason for doing something in that program and it would make any alterations and/or additions more time consuming because I would have to take take extra time trying to learn the code and why I did certain things before I did the new work. Commenting code lets you quickly learn what certain code is and shortens familiarisation time and helps others who may be required to do work with your code become familiar too.
The comments boxes would allow you to put explanations for what the button or frame does. One of the really confusing parts of the NetRemote learning process I found was discovering what the actual elements do in the example ccf's.
For example the slider button component starts off as a basic button before being changed on the Position/Advanced tab... then it looks like a frame element but with an up/down image. I banged my head on the wall several times before I figured that it starts off as a button and not a frame. Once I realised to look for the dual button up/down states at the bottom I then got confused as to where the lua that controlled the slider was as it wasn't connected to the slider. I didn't know what to look for in the help file and so the examples I found didn't help me. Having a comment box explaining the use of sliders would have helped greatly.
Here is what I would have put on an example slider tutorial.
This slider button is configured on the Position/Advanced tab. The "Component" dropdown box shows it is a slider button by displaying "NRBasic:Slider Thumb Component" and the "Set Properties" button next to it allows you to set the variable (VAR) which is controlled by the slider, the starting position of the slider (STARTVALUE), the minimum slider value returned (MIN) and the maximum slider value returned (MAX). It also allows you to choose whether to send the value only when you release the slider button or continuously (OPTIONS: Send on release only) and also the frequency the slider value is sent using the THROTTLE value.
Some sliders control inbuilt NetRemote parameters (like here MP.GAC[8].CurrentPage which controls the page of album or artist results) and others control values that are defined and monitored in Lua programming using NetRemote.RegisterVariableWatch commands (which will be described in the relevant custom slider button). In this case where the value you want to use is a NetRemote parameter the MIN value should be set to 1 and the MAX value should be set to 1000. The actual values will be set by the NetRemote parameter itself by making itself a ratio of 1000...
For this example moving the slider if there are only 2 pages of results will work as follows...
If the value returned by the slider is between 1 and 500 it will show page 1.
If the value returned by the slider is between 501 and 1000 it will show page 2.
For this example moving the slider if there are only 3 pages of results will work as follows...
If the value returned by the slider is between 1 and 333 it will show page 1.
If the value returned by the slider is between 334 and 666 it will show page 2.
If the value returned by the slider is between 667 and 1000 it will show page 3.
If the above comments was in a Comments box or tab it would have helped me grasp the idea of sliders a lot quicker. Currently it means looking at the ccf and then having to search through the help files and trying to figure out how the heck the thing manages to control the page - it took me a couple of days because of having to figure out that the missing actions page didn't mean it was an element that did nothing. I was actually trying to figure out why the slider frame did nothing would you believe. DOH! :rolleyes: I then spent ages looking through the main Lua for the NetRemote.RegisterWatch that was called by the above slider... and obviously failed to find it because the above slider controlled the NR parameter directly. Hence the screaming need for comments... to stop new users screaming at NR that is ;)
Edit: If you do add the comments boxes I would be willing to volunteer to add comments to mce1024x768.ccf for all the stuff I've learned recently through blood, sweat and loads of tears... Hopefully my recent experience learning NRD coding will come to good use helping new users. I still have a ways to go but am gaining ground but so unfortunately my avatars "ODNAQA" will still be in effect for quite a while yet (that's "Oh Darn, NeoMorph's Asking Questions Again")