OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 6095|回复: 5

ucgui 怎么样使对话框重绘

[复制链接]

11

主题

34

帖子

0

精华

初级会员

Rank: 2

积分
98
金钱
98
注册时间
2015-1-9
在线时间
0 小时
发表于 2015-1-21 11:36:22 | 显示全部楼层 |阅读模式
5金钱
如题,ucgui  怎么样使对话框重绘,求解答

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

88

主题

7377

帖子

5

精华

资深版主

Rank: 8Rank: 8

积分
14980
金钱
14980
注册时间
2013-11-13
在线时间
1823 小时
发表于 2015-1-21 11:54:32 | 显示全部楼层
开往春天的手扶拖拉机
回复

使用道具 举报

11

主题

34

帖子

0

精华

初级会员

Rank: 2

积分
98
金钱
98
注册时间
2015-1-9
在线时间
0 小时
 楼主| 发表于 2015-1-21 12:08:45 | 显示全部楼层
使用了,但是没用,我直接调用WM_paint都没用
回复

使用道具 举报

11

主题

34

帖子

0

精华

初级会员

Rank: 2

积分
98
金钱
98
注册时间
2015-1-9
在线时间
0 小时
 楼主| 发表于 2015-1-21 12:17:18 | 显示全部楼层
#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 "ROGBAR.h"
#include "SCROLLBAR.h"
#include "LISTVIEW.h"





//EventsFunctionList
//void OnButton5Release(WM_MESSAGE * pMsg);
//void OnButton4Release(WM_MESSAGE * pMsg);
//void OnButton3Release(WM_MESSAGE * pMsg);
//void OnButton2Release(WM_MESSAGE * pMsg);
//void OnButton1Release(WM_MESSAGE * pMsg);
//void OnButton0Released(WM_MESSAGE * pMsg);
//EndofEventsFunctionList

int x = 0 ;
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
    { FRAMEWIN_CreateIndirect,  "Caption",           0,                       0,  0,  800,480,FRAMEWIN_CF_MOVEABLE,0},
    { BUTTON_CreateIndirect,    "BUTTON0",           GUI_ID_BUTTON0,          186,164,136,83, 0,0},
    { BUTTON_CreateIndirect,    "BUTTON0",           GUI_ID_BUTTON1,          318,164,136,83, 0,0},
    { BUTTON_CreateIndirect,    "BUTTON0",           GUI_ID_BUTTON2,          450,164,136,83, 0,0},
    { BUTTON_CreateIndirect,    "BUTTON0",           GUI_ID_BUTTON3,          186,243,136,83, 0,0},
    { BUTTON_CreateIndirect,    "BUTTON0",           GUI_ID_BUTTON4,          318,243,136,83, 0,0},
    { BUTTON_CreateIndirect,    "BUTTON0",           GUI_ID_BUTTON5,          450,243,136,83, 0,0}
};


void aintDialog(WM_MESSAGE * pMsg)
{
    WM_HWIN hWin = pMsg->hWin;
GUI_DispDecAt(x,100,5 ,2);

}



void InitDialog(WM_MESSAGE * pMsg)
{
    WM_HWIN hWin = pMsg->hWin;
      FRAMEWIN_SetClientColor(hWin,0xff0000);
    FRAMEWIN_SetTitleVis(hWin,0);
     BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON0),BUTTON_CI_UNPRESSED,0xff0000);
    //
    //GUI_ID_BUTTON1
    //
    BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON1),BUTTON_CI_UNPRESSED,0xff0000);
    //
    //GUI_ID_BUTTON2
    //
    BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON2),BUTTON_CI_UNPRESSED,0xff0000);
    //
    //GUI_ID_BUTTON3
    //
    BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON3),BUTTON_CI_UNPRESSED,0xff0000);
    //
    //GUI_ID_BUTTON4
    //
    BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON4),BUTTON_CI_UNPRESSED,0xff0000);
    //
    //GUI_ID_BUTTON5
    //
    BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON5),BUTTON_CI_UNPRESSED,0xff0000);

}




static void _cbCallback(WM_MESSAGE * pMsg) 
{
    int NCode, Id;
    WM_HWIN hWin = pMsg->hWin;
    switch (pMsg->MsgId) 
    {
        case WM_PAINT:
            aintDialog(pMsg);
            break;
        case WM_INIT_DIALOG:
            InitDialog(pMsg);
            break;
        case WM_KEY:
            switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) 
            {
                case GUI_KEY_ESCAPE:
                    GUI_EndDialog(hWin, 1);
                    break;
                case GUI_KEY_ENTER:
                    GUI_EndDialog(hWin, 0);
                    break;
            }
            break;
        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;
                case GUI_ID_CANCEL:
                    if(NCode==WM_NOTIFICATION_RELEASED)
                        GUI_EndDialog(hWin, 0);
                    break;
                case GUI_ID_BUTTON0:
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_RELEASED:
                           // OnButton0Released(pMsg);
                             x++
WM_Paint(hWin);
WM_Exec();
                           break;
                    }
                    break;
                case GUI_ID_BUTTON1:
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_RELEASED:
                           // OnButton1Release(pMsg);
                             x++
WM_Paint(hWin);
WM_Exec();

                            break;
                    }
                    break;
                case GUI_ID_BUTTON2:
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_RELEASED:
                        //    OnButton2Release(pMsg);
                             x++
WM_Paint(hWin);
WM_Exec();

                            break;
                    }
                    break;
                case GUI_ID_BUTTON3:
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_RELEASED:
                          //  OnButton3Release(pMsg);
                             x++
WM_Paint(hWin);
WM_Exec();

                            break;
                    }
                    break;
                case GUI_ID_BUTTON4:
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_RELEASED:
                         //   OnButton4Release(pMsg);
                             x++
WM_Paint(hWin);
WM_Exec();

                            break;
                    }
                    break;
                case GUI_ID_BUTTON5:
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_RELEASED:
                            OnButton5Release(pMsg);
                            break;
                    }
                    break;

            }
            break;
        default:
            WM_DefaultProc(pMsg);
    }
}


/*********************************************************************
*
*       MainTask
*
**********************************************************************
*/
void MainTask(void) 

    GUI_Init();
    WM_SetDesktopColor(GUI_WHITE);      /* Automacally update desktop window */
    WM_SetCreateFlags(WM_CF_MEMDEV);  /* Use memory devices on all windows to avoid flicker */
    //PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX);
    //FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX);
    //PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX);
    //BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX);
    //CHECKBOX_SetDefaultSkin(CHECKBOX_SKIN_FLEX);
    //DROPDOWN_SetDefaultSkin(DROPDOWN_SKIN_FLEX);
    //SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX);
    //SLIDER_SetDefaultSkin(SLIDER_SKIN_FLEX);
    //HEADER_SetDefaultSkin(HEADER_SKIN_FLEX);
    //RADIO_SetDefaultSkin(RADIO_SKIN_FLEX);
    GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0);
}

我只想按钮按一下x值+1,然后在屏幕上显示出来,可是好象不行,
回复

使用道具 举报

28

主题

1489

帖子

0

精华

论坛大神

Rank: 7Rank: 7Rank: 7

积分
1656
金钱
1656
注册时间
2013-7-24
在线时间
1 小时
发表于 2015-1-21 14:48:34 | 显示全部楼层
如果总重绘,那GUI的机制就没用了,建议采用修改方式。
于20150522停用该账号:http://www.microstar.club
回复

使用道具 举报

3

主题

154

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
434
金钱
434
注册时间
2013-3-18
在线时间
82 小时
发表于 2015-1-21 15:14:19 | 显示全部楼层
WM_Paint(hWin)改为WM_InvalidateWindow(hWin)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-11-23 08:52

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表