MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / ControlGetContents

Method ControlGetContents

source/script_gui.cpp:7818–7881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7816
7817
7818ResultType GuiType::ControlGetContents(ResultToken &aResultToken, GuiControlType &aControl, ValueModeType aMode)
7819{
7820 // Control types for which Text and Value both have special handling:
7821 switch (aControl.type)
7822 {
7823 case GUI_CONTROL_DROPDOWNLIST: return ControlGetDDL(aResultToken, aControl, aMode);
7824 case GUI_CONTROL_COMBOBOX: return ControlGetComboBox(aResultToken, aControl, aMode);
7825 case GUI_CONTROL_LISTBOX: return ControlGetListBox(aResultToken, aControl, aMode);
7826 case GUI_CONTROL_TAB: return ControlGetTab(aResultToken, aControl, aMode);
7827
7828 case GUI_CONTROL_TEXT: // See case GUI_CONTROL_TEXT in ControlSetContents() for the reasoning behind this.
7829 case GUI_CONTROL_PIC: // The control's window text is usually the original filename.
7830 aMode = Text_Mode; // Value and Text both return the window text.
7831 break;
7832 }
7833 // The remaining control types have no need for special handling of the Text property,
7834 // either because they have normal caption text, or because they have no "text version"
7835 // of the value, or no "value" at all.
7836 if (aMode == Text_Mode)
7837 {
7838 return ControlGetWindowText(aResultToken, aControl);
7839 }
7840 // Otherwise, it's the Value property or Submit method.
7841 switch (aControl.type)
7842 {
7843 case GUI_CONTROL_RADIO: // Same as below.
7844 case GUI_CONTROL_CHECKBOX: return ControlGetCheck(aResultToken, aControl);
7845 case GUI_CONTROL_EDIT: return ControlGetEdit(aResultToken, aControl);
7846 case GUI_CONTROL_DATETIME: return ControlGetDateTime(aResultToken, aControl);
7847 case GUI_CONTROL_MONTHCAL: return ControlGetMonthCal(aResultToken, aControl);
7848 case GUI_CONTROL_HOTKEY: return ControlGetHotkey(aResultToken, aControl);
7849 case GUI_CONTROL_UPDOWN: return ControlGetUpDown(aResultToken, aControl);
7850 case GUI_CONTROL_SLIDER: return ControlGetSlider(aResultToken, aControl);
7851 case GUI_CONTROL_PROGRESS: return ControlGetProgress(aResultToken, aControl);
7852
7853 case GUI_CONTROL_ACTIVEX:
7854 aControl.union_object->AddRef();
7855 _o_return(aControl.union_object);
7856
7857 // Already handled in the switch() above:
7858 //case GUI_CONTROL_DATETIME:
7859 //case GUI_CONTROL_DROPDOWNLIST:
7860 //case GUI_CONTROL_COMBOBOX:
7861 //case GUI_CONTROL_LISTBOX:
7862 //case GUI_CONTROL_TAB:
7863 //case GUI_CONTROL_PIC:
7864 //case GUI_CONTROL_TEXT:
7865
7866 case GUI_CONTROL_LINK:
7867 case GUI_CONTROL_GROUPBOX:
7868 case GUI_CONTROL_BUTTON:
7869 case GUI_CONTROL_STATUSBAR:
7870 // Above: The control has no "value". GuiControl.Text should be used to get its text.
7871 case GUI_CONTROL_LISTVIEW: // More flexible methods are available.
7872 case GUI_CONTROL_TREEVIEW: // More flexible methods are available.
7873 case GUI_CONTROL_CUSTOM: // Don't know what this control's "value" is or how to get it.
7874 default: // Should help code size by allowing the compiler to omit checks for the above cases.
7875 // The concept of a "value" does not apply to these controls. Value could be

Callers 1

InvokeMethod · 0.80

Calls 1

AddRefMethod · 0.45

Tested by

no test coverage detected