📄 control.h
字号:
wc.Attach("Data1");
wc.Update();
Remarks:
*/
BOOL Attach(LPCSTR lpcszWorksheetName);
/**
Update the control
Parameters:
None.
Return:
None.
Example:
WorksheetControl wc = dlg.GetItem(IDC_WORKSHEET);
wc.Attach("Data1");
wc.Update();
Remarks:
*/
void Update();
/**
Update the control
Parameters:
nCol = column index,
int nType = the column type. it can be following constants defined in OC_const.h
#define OKCOLTYPE_NUMERIC 0
#define OKCOLTYPE_TEXT 1
#define OKCOLTYPE_TIME 2
#define OKCOLTYPE_DATE 3
#define OKCOLTYPE_MONTH 4
#define OKCOLTYPE_WEEKDAY 5
#define OKCOLTYPE_COLUMN 6
#define OKCOLTYPE_DATASET 7
#define OKCOLTYPE_DATASET_X 8
#define OKCOLTYPE_TEXT_NUMERIC 9
#define OKCOLTYPE_CATEGORICAL 0x000A
int nDesignation = the column designation, it can be following values defined in OC_const.h
enum
{
OKDATAOBJ_DESIGNATION_Y = 0,
OKDATAOBJ_DESIGNATION_NONE,
OKDATAOBJ_DESIGNATION_ERROR,
OKDATAOBJ_DESIGNATION_X,
OKDATAOBJ_DESIGNATION_L,
OKDATAOBJ_DESIGNATION_Z,
OKDATAOBJ_DESIGNATION_X_ERROR,
};
Return:
TRUE for success.
Example:
WorksheetControl wc = dlg.GetItem(IDC_WORKSHEET);
wc.Attach("Data1");
int nCol = 1;
int nType;
int nDesignation;
ASSERT(wc.GetColInfo(nCol, nType, nDesignation));
Remarks:
*/
BOOL GetColInfo( int nCol, int& nType, int& nDesignation );
/**
Remark:
Used to apply designation pattern to entire worksheet control
Parameters:
lpcszDesignations - designation pattern
Possible values for designations:
'X' - X column
'Y' - Y column
'Z' - Z column
'E' - Y error column
'L' - label column
'M' - X error column
'N' - ignore column
bRepeat - repeat pattern. Defines how the pattern is applied
if number of columns in worksheet control is larger then length of pattern.
Possible values:
TRUE - repeat entire pattern
FALSE - set designations for the rest of columns to be the last one deifined by pattern
Example:
// the following code will set column designations in worksheet control
// 1st column - X
// 2nd column - Y
// 3rd column - label
// 4th column - Y
// 5rd column - label
// pattern will repeat if worksheet control contains more than 5 columns
WorksheetControl wc = dlg.GetItem(IDC_WORKSHEET);
wc.Attach("Data1");
wc.SetColDesignations("XYLYL");
Return:
TRUE for success. Otherwise FALSE;
*/
BOOL SetColDesignations(LPCSTR lpcszDesignations, BOOL bRepeat = TRUE);
/**
Remark:
Gets column designations for entire worksheet control in form of string
Possible values for designations:
'X' - X column
'Y' - Y column
'Z' - Z column
'E' - Y error column
'L' - label column
'M' - X error column
'N' - ignore column
Example:
WorksheetControl wc = dlg.GetItem(IDC_WORKSHEET);
wc.Attach("Data1");
string strDesignations = wc.GetColDesignations();
*/
string GetColDesignations();
/**
Remark:
Gets column designations for entire worksheet in form of string
Possible values for designations:
'X' - X column
'Y' - Y column
'Z' - Z column
'E' - Y error column
'L' - label column
'M' - X error column
'N' - ignore column
Example:
WorksheetControl wc = dlg.GetItem(IDC_WORKSHEET);
wc.Attach("Data1");
string strDesignations;
wc.GetColDesignations(strDesignations);
*/
void GetColDesignations(string& strDesignations);
/**
*/
BOOL SetColFormats(LPCSTR lpcszFormats, BOOL bRepeat = TRUE);
/**
*/
string GetColFormats();
/**
*/
void GetColFormats(string& strFormats);
/**
Remove all items
Parameters:
None.
Return:
None.
Example:
WorksheetControl wc = dlg.GetItem(IDC_WORKSHEET);
wc.Attach("Data1");
wc.RemoveAllItems();
Remarks:
*/
void RemoveAllItems();
};
/** >User Interface Controls
This class is only available to OriginPro users.
Example:
*/
class Button : public Control
{
public:
/**
*/
Button();
/**
*/
Button(Control& ctrl);
/**
Example:
Button m_CheckBtn = MyDlg.GetItem(IDC_CHECK1);
if(m_CheckBtn.Check)
{
out_str("Selected!");
}
*/
int Check;
};
/** >User Interface Controls
This class is only available to OriginPro users.
Example:
*/
class BitmapRadioButton : public Button
{
public:
/**
*/
BitmapRadioButton();
/**
*/
BitmapRadioButton(Control& ctrl);
/**
*/
BOOL Init(UINT nStates, UINT nBmpResID, UINT nBmpSliceWidth, vector<string> & vstrTips, UINT nBmpOffset = 0);
};
/** >User Interface Controls
This class is only available to OriginPro users.
Example:
*/
class ComboBox : public Control
{
public:
/**
*/
ComboBox();
/**
*/
ComboBox(Control& ctrl);
/**
Example:
ComboBox m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
int nSel = 3;
m_cmbBox.SetCurSel( nSel );
ASSERT( 3 == m_cmbBox.GetCurSel() );
*/
int GetCurSel() const;
/**
*/
void SetCurSel(int nSelect);
/**
Example:
ComboBox m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
int nCount = m_cmbBox.GetCount();
*/
int GetCount() const;
/**
Example:
string strText;
ComboBox m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
m_cmbBox.GetLBText(m_cmbBox.GetCurSel() ,strText);
out_str(strText);
*/
void GetLBText(int nIndex, string& str) const;
/**
Example:
string strText("Red");
ComboBox m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
int nCount = m_cmbBox.GetCount();
int nRet = m_cmbBox.AddString(strText);
ASSERT(nCount+1 == m_cmbBox.GetCount());
*/
int AddString(LPCSTR lpcsz);
/**
Example:
ComboBox m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
string str = "try";
int nInsert = m_cmbBox.InsertString(0, str);
*/
int InsertString(int nIndex, LPCSTR lpcsz);
/**
Example:
ComboBox m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
string str = "try";
int nRet = m_cmbBox.DeleteString(str);
*/
int DeleteString(int nIndex);
/**
Example:
ComboBox m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
DWORD dData = 100;
int nSetData = m_cmbBox.SetItemData(0,dData);
*/
int SetItemData(int nIndex, DWORD dwData);
/**
Example:
ComboBox m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
DWORD dData = m_cmbBox.GetItemData(0);
*/
DWORD GetItemData(int nIndex) const;
/**
*/
void ResetContent();
/**
Example:
ComboBox m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
int nSel = m_cmbBox.SelectString(0,"try");
*/
int SelectString(int nStartAfter, LPCSTR lpcsz);
};
/** >User Interface Controls
This class is only available to OriginPro users.
Example:
*/
class ListBox : public Control
{
public:
/**
*/
ListBox();
/**
*/
ListBox(Control& ctrl);
/**
Example:
ListBox m_List = MyDlg.GetItem(IDC_LIST1);
int nSel = m_List.GetCurSel();
*/
int GetCurSel() const;
/**
Example:
ListBox m_List = MyDlg.GetItem(IDC_LIST1);
m_List.SetCurSel(1);
*/
void SetCurSel(int nSelect);
/**
Example:
ListBox m_List = MyDlg.GetItem(IDC_LIST1);
int nCount = m_List.GetCount();
*/
int GetCount() const;
/**
Example:
ListBox m_List = MyDlg.GetItem(IDC_LIST1);
string str;
m_List.GetText(0,str);
out_str(str);
*/
void GetText(int nIndex, string& str);
/**
Example:
ListBox m_List = MyDlg.GetItem(IDC_LIST1);
int nAdd = m_List.AddString("Test");
*/
int AddString(LPCSTR lpcsz);
/**
Example:
ListBox m_List = MyDlg.GetItem(IDC_LIST1);
int nRet = m_List.InsertString(0, "Good");
*/
int InsertString(int nIndex, LPCSTR lpcsz);
/**
Example:
ListBox m_List = MyDlg.GetItem(IDC_LIST1);
int nRet = m_List.DeleteString(0);
*/
int DeleteString(int nIndex);
/**
*/
void ResetContent();
};
#define MF_STRING 0x00000000L
#define MF_ENABLED 0x00000000L
#define MF_GRAYED 0x00000001L
#define MF_DISABLED 0x00000002L
#define MF_UNCHECKED 0x00000000L
#define MF_CHECKED 0x00000008L
/** >User Interface Controls
This class is only available to OriginPro users.
Example:
*/
class Menu
{
public:
/**
*/
Menu();
/**
*/
Menu(Menu& menu);
/**
*/
BOOL Add(LPCSTR lpcszText, Function fnHandler, UINT nFlags = MF_STRING);
/**
*/
BOOL Create();
/**
*/
BOOL TrackPopupMenu(UINT nFlags, int x, int y, HWND hwnd);
/**
*/
Window GetOwnerWindow();
/**
*/
int GetMenuItemID(uint nPos);
};
#endif //_CONTROL_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -