Jump to content

Function naming suggestion


NiTroGen
 Share

Recommended Posts

We have a lot of function pairs like

GUICtrlGetState & GUICtrlSetState

GUICtrlGetStyle & GUICtrlSetStyle

BUT

GUICtrlRead & GUICtrlSetData

I understand that GUICtrlRead can return additional state information, but for more easy understanding,

how about renaming GUICtrlRead to GUICtrlGetData?

(When I am a GUI newbie, I did spend some time to find out this function as I assume it should be called GUICtrlGetData)

Edited by NiTroGen
Link to comment
Share on other sites

I never support alias. For renaming, it should be easy. Just a minutes of automatic search & replace for all au3/decompressed chm files can do.

In the past, TimerStart was being renamed as TimerInit. Therefore, I expect renaming of function is allowed in autoit development, if bearing strong reason.

Moreover, how come GUICtrlRead is not being named "GUICtrlSetData" at the beginning?

Anyone can give me some hints?

Link to comment
Share on other sites

Yeah, I have an include somewhere down deep in my HDD called Irregularities.au3 that fixes some of this stuff.. but Richard is right. It really doesn't matter that much, I just used that when I used to forget all the function names :)

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

@sandman

Would you share your Irregularities.au3

I couldn't find it.. so here's one I whipped up for ya:
#include-once

#cs
===============================================================================

Description:        Rename a file.
Parameter(s):       $sOriginal: The original file name.
                    $sNew: The desired file name.
                    $iFlag: Determines whether or not to overwrite files with the same name.
                        0 (default) : Do not overwrite files.
                        1           : Overwrite existing files.
Requirement(s):     None.
Return Value(s):    On Success: 1
                    On Failure: 0
Author(s):          sandman
Note(s):            

===============================================================================
#ce
Func FileRename($sOriginal, $sNew, $iFlag = 0)
    Local $move = FileMove($sOriginal, $sNew, $iFlag)
    If $move = 0 Then
        Return 0
    Else
        Return 1
    EndIf
EndFunc

#cs
===============================================================================

Description:        Get the data of a control.
Parameter(s):       $hControl: The control identifier (controlID) as returned by a GUICtrlCreate... function.
                    $iAdvanced: Returns extended information of a control.
                        0 (default) : Returns a value with the data of a control.
                        1           : Returns extended information of a control (see Notes #2)
Requirement(s):     A valid created control.
Return Value(s):    On Success: The data of the control.
                    On Failure: 0
Author(s):          sandman
Note(s):            #1
                        Type                    Value 
                        Checkbox, Radio         State of the button.
                        Combo, List             The value selected 
                        Input, Edit             The text entered 
                        Button                  The display text 
                        Date                    The selected date 
                        Progress                Current percentage 
                        Slider                  Current value 
                        Tab                     The number or the controlID of the tabitem selected depending of the advanced parameter value. 
                        Menu, MenuItem          State of the menu/item. See State table  
                        TreeView                Control identifier (controlID) of the selected TreeViewItem 
                        TreeViewItem            State of the TreeViewItem 
                        ListView                Control identifier (controlID) of the selected ListViewItem. 0 means no item is selected 
                        Dummy                   The value set by GUICtrlSendToDummy or GUICtrlSetData
                    #2
                        In advanced mode the return value contains additional data of the control.
                        Type                    Additional Value 
                        Checkbox, Radio         The text of the control. 
                        Menu, MenuItem          The text of the control. 
                        TreeView                The text of the current selected TreeViewItem. 
                        TreeViewItem            The text of the TreeViewItem. 
                        ListViewItem            The state of the ListViewItem if $LVS_EX_CHECKBOXES exStyle used in advanced mode. See State table  
                        Tab                     The controlID of the tabitem selected 

===============================================================================
#ce
Func GUICtrlGetData($hControl, $iAdvanced = 0)
    Local $read = GUICtrlRead($hControl, $iAdvanced)
    If $read <> 0 Then
        Return $read
    Else
        Return 0
    EndIf
EndFunc

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...