用ucguibuilder添加一个button的控件,下面是code,应该在什么位置添加有关于button的程序代码
/*********************************************************************uCGUIBuilder***...
/*
******************************************************************
** uCGUIBuilder **
** Version: 4.0.0.0 **
** 2012 / 04 **
** CpoyRight to: wyl **
** Email:ucguibuilder@163.com **
** This text was Created by uCGUIBuilder **
******************************************************************/
#include <stddef.h>
#include "GUI.h"
#include "DIALOG.h"
#include "WM.h"
#include "BUTTON.h"
#include "CHECKBOX.h"
#include "DROPDOWN.h"
#include "EDIT.h"
#include "FRAMEWIN.h"
#include "LISTBOX.h"
#include "MULTIEDIT.h"
#include "RADIO.h"
#include "SLIDER.h"
#include "TEXT.h"
#include "PROGBAR.h"
#include "SCROLLBAR.h"
#include "LISTVIEW.h"
//EventsFunctionList
//EndofEventsFunctionList
/*********************************************************************
*
* static data
*
**********************************************************************
*/
/*********************************************************************
*
* Dialog resource
*
* This table conatins the info required to create the dialog.
* It has been created by ucGUIbuilder.
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ FRAMEWIN_CreateIndirect, "Caption", 0, 0, 0, 481,303,FRAMEWIN_CF_MOVEABLE,0},
{ BUTTON_CreateIndirect, "BUTTON0", GUI_ID_BUTTON0, 66, 48, 151,100,0,0}
};
/*****************************************************************
** FunctionName:void PaintDialog(WM_MESSAGE * pMsg)
** Function: to initialize the Dialog items
**
** call this function in _cbCallback --> WM_PAINT
*****************************************************************/
void PaintDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
}
/*****************************************************************
** FunctionName:void InitDialog(WM_MESSAGE * pMsg)
** Function: to initialize the Dialog items
**
** call this function in _cbCallback --> WM_INIT_DIALOG
*****************************************************************/
void InitDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
//
//FRAMEWIN
//
FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0);
FRAMEWIN_AddMaxButton(hWin, FRAMEWIN_BUTTON_RIGHT, 1);
FRAMEWIN_AddMinButton(hWin, FRAMEWIN_BUTTON_RIGHT, 2);
}
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch (Id)
{
case GUI_ID_OK:
if(NCode==WM_NOTIFICATION_RELEASED)
GUI_EndDialog(hWin, 0);
break; 展开
******************************************************************
** uCGUIBuilder **
** Version: 4.0.0.0 **
** 2012 / 04 **
** CpoyRight to: wyl **
** Email:ucguibuilder@163.com **
** This text was Created by uCGUIBuilder **
******************************************************************/
#include <stddef.h>
#include "GUI.h"
#include "DIALOG.h"
#include "WM.h"
#include "BUTTON.h"
#include "CHECKBOX.h"
#include "DROPDOWN.h"
#include "EDIT.h"
#include "FRAMEWIN.h"
#include "LISTBOX.h"
#include "MULTIEDIT.h"
#include "RADIO.h"
#include "SLIDER.h"
#include "TEXT.h"
#include "PROGBAR.h"
#include "SCROLLBAR.h"
#include "LISTVIEW.h"
//EventsFunctionList
//EndofEventsFunctionList
/*********************************************************************
*
* static data
*
**********************************************************************
*/
/*********************************************************************
*
* Dialog resource
*
* This table conatins the info required to create the dialog.
* It has been created by ucGUIbuilder.
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ FRAMEWIN_CreateIndirect, "Caption", 0, 0, 0, 481,303,FRAMEWIN_CF_MOVEABLE,0},
{ BUTTON_CreateIndirect, "BUTTON0", GUI_ID_BUTTON0, 66, 48, 151,100,0,0}
};
/*****************************************************************
** FunctionName:void PaintDialog(WM_MESSAGE * pMsg)
** Function: to initialize the Dialog items
**
** call this function in _cbCallback --> WM_PAINT
*****************************************************************/
void PaintDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
}
/*****************************************************************
** FunctionName:void InitDialog(WM_MESSAGE * pMsg)
** Function: to initialize the Dialog items
**
** call this function in _cbCallback --> WM_INIT_DIALOG
*****************************************************************/
void InitDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
//
//FRAMEWIN
//
FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0);
FRAMEWIN_AddMaxButton(hWin, FRAMEWIN_BUTTON_RIGHT, 1);
FRAMEWIN_AddMinButton(hWin, FRAMEWIN_BUTTON_RIGHT, 2);
}
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch (Id)
{
case GUI_ID_OK:
if(NCode==WM_NOTIFICATION_RELEASED)
GUI_EndDialog(hWin, 0);
break; 展开
1个回答
展开全部
UIButton *setButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
//button坐标
setButton.frame = CGRectMake(120, 120, 120, 120);
//button上面子的颜色
[setButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//button上显示子名字
[setButton setTitle:@"set" forState:UIControlStateNormal];
//添加setbutton点击事件 更换lable的text
[setButton addTarget:self action:@selector(lableSet) forControlEvents:UIControlEventTouchUpInside];
//button添加到controller的view上,resbutton同理
[self.view addSubview:setButton];
//button坐标
setButton.frame = CGRectMake(120, 120, 120, 120);
//button上面子的颜色
[setButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//button上显示子名字
[setButton setTitle:@"set" forState:UIControlStateNormal];
//添加setbutton点击事件 更换lable的text
[setButton addTarget:self action:@selector(lableSet) forControlEvents:UIControlEventTouchUpInside];
//button添加到controller的view上,resbutton同理
[self.view addSubview:setButton];
追问
哥,这段程序写在code的什么位置啊
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询