Jump to content

Recommended Posts

Posted (edited)

I have a piece of code that I what I feel to long in length. It is as follows:

Func SO_EDIT()
    ControlSetText("Label Data Entry", "", $SO, "")
    GUICtrlSetState($SO, $GUI_ENABLE)
    GUICtrlSetState($SO, $GUI_FOCUS)
    $LOG_EVENT = "Clicked Sales Order Edit"
    User_Log()
EndFunc ;==>SO_EDIT
Func CUST_EDIT()
    ControlSetText("Label Data Entry", "", $CUST, "")
    GUICtrlSetState($CUST, $GUI_ENABLE)
    GUICtrlSetState($CUST, $GUI_FOCUS)
    $LOG_EVENT = "Clicked Customaer Part Number Edit"
    User_Log()
EndFunc ;==>CUST_EDIT
Func TRW_EDIT()
    ControlSetText("Label Data Entry", "", $TRW, "")
    GUICtrlSetState($TRW, $GUI_ENABLE)
    GUICtrlSetState($TRW, $GUI_FOCUS)
    $LOG_EVENT = "Clicked TRW Kit Number Edit"
    User_Log()
EndFunc ;==>TRW_EDIT
Func DUE_EDIT()
    ControlSetText("Label Data Entry", "", $DUE, "")
    GUICtrlSetState($DUE, $GUI_ENABLE)
    GUICtrlSetState($DUE, $GUI_FOCUS)
    $LOG_EVENT = "Clicked Due Date Edit"
    User_Log()
EndFunc ;==>DUE_EDIT
Func QTY_EDIT()
    ControlSetText("Label Data Entry", "", $QTY, "")
    GUICtrlSetState($QTY, $GUI_ENABLE)
    GUICtrlSetState($QTY, $GUI_FOCUS)
    $LOG_EVENT = "Clicked Quantity Requested Edit"
    User_Log()
EndFunc ;==>QTY_EDIT
Func MSTR_EDIT()
    ControlSetText("Label Data Entry", "", $MSTR, "")
    GUICtrlSetState($MSTR, $GUI_ENABLE)
    GUICtrlSetState($MSTR, $GUI_FOCUS)
    $LOG_EVENT = "Clicked Quantity Per Master Edit"
    User_Log()
EndFunc ;==>MSTR_EDIT
Func PER_EDIT()
    ControlSetText("Label Data Entry", "", $PER, "")
    GUICtrlSetState($PER, $GUI_ENABLE)
    GUICtrlSetState($PER, $GUI_FOCUS)
    $LOG_EVENT = "Clicked Quantity Per Pallet Edit"
    User_Log()
EndFunc ;==>PER_EDIT

Is it possible to place a variable into a function name? This way I'd be able to loop it.

*EDIT* I don't know anything about arrays but what I've read might sound like would do the trick. Any thoughts?

Edited by strate
INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Posted

I don't know anything about arrays but what I've read might sound like would do the trick. Any thoughts?

You hit the nail on the head. Arrays are fun, fantastic, and fraught with functionality. Check out the examples in the manual and the forum and try some code. If I can learn them, anyone can! Then post your code here if they don't do the job for you...;)
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

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
×
×
  • Create New...