硬汉嵌入式论坛

 找回密码
 立即注册
查看: 8554|回复: 7
收起左侧

[μCGUI] 版主帮忙,UCGUI 显示问题

[复制链接]

16

主题

27

回帖

75

积分

初级会员

积分
75
发表于 2013-7-12 11:50:45 | 显示全部楼层 |阅读模式
建了一个FRAMEWIN的框架窗体。不能用函数例如GUI_DispString() 在上面显示字符。。是不是要设置透明什么的,,不大懂。。请版主解答下。。
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106934
QQ
发表于 2013-7-12 11:52:47 | 显示全部楼层
把你的代码贴出来
回复

使用道具 举报

16

主题

27

回帖

75

积分

初级会员

积分
75
 楼主| 发表于 2013-7-12 12:00:26 | 显示全部楼层
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
    { FRAMEWIN_CreateIndirect,   NULL,               0,                       0,  0,  480,272,FRAMEWIN_CF_MOVEABLE,0},
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


void MainTask(void)
{
    GUI_Init();
    WM_SetDesktopColor(GUI_BLUE);      /* Automacally update desktop window */
    WM_SetCreateFlags(WM_CF_MEMDEV);  /* Use memory devices on all windows to avoid flicker */
   GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0);
  GUI_DispStringAt("HELLO WORLD",200,200);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
就是用ucguibuilt 建立framewin后 在maintask 里写了个显示字符的函数 ,,如果不建立framewin框架 则可以正常显示。。。
回复

使用道具 举报

16

主题

27

回帖

75

积分

初级会员

积分
75
 楼主| 发表于 2013-7-12 13:49:49 | 显示全部楼层

回 eric2013 的帖子

eric2013:把你的代码贴出来 (2013-07-12 11:52) 
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
    { FRAMEWIN_CreateIndirect,   NULL,               0,                       0,  0,  480,272,FRAMEWIN_CF_MOVEABLE,0},
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


void MainTask(void)
{
    GUI_Init();
    WM_SetDesktopColor(GUI_BLUE);      /* Automacally update desktop window */
    WM_SetCreateFlags(WM_CF_MEMDEV);  /* Use memory devices on all windows to avoid flicker */
   GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0);
  GUI_DispStringAt("HELLO WORLD",200,200);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
就是用ucguibuilt 建立framewin后 在maintask 里写了个显示字符的函数 ,,如果不建立framewin框架 则可以正常显示。。
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106934
QQ
发表于 2013-7-12 17:39:40 | 显示全部楼层
你这种情况是把他显示在了桌面窗口上面,并没有显示到对话框上面
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106934
QQ
发表于 2013-7-12 17:56:59 | 显示全部楼层
给你写了一个代码,研究一下

#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 &quotROGBAR.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,  480,272,FRAMEWIN_CF_MOVEABLE,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;
        GUI_DispStringAt("HELLO WORLD",10,10);

}

/*****************************************************************
**      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);
    FRAMEWIN_SetTitleHeight(hWin,20);

}

/*********************************************************************
*
*       Dialog callback routine
*/
static void _cbCallback(WM_MESSAGE * pMsg)
{
    int NCode, Id;
    WM_HWIN hWin = pMsg->hWin;
    switch (pMsg->MsgId)
    {
        case WM_PAINT:
            PaintDialog(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;

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

/*
*********************************************************************************************************
*        函 数 名: MainTask
*        功能说明: GUI主函数
*        形    参:无
*        返 回 值: 无
*********************************************************************************************************
*/

void MainTask(void)
{
    GUI_Init();

    WM_SetCreateFlags(WM_CF_MEMDEV);
    WM_SetDesktopColor(GUI_BLUE);      /* Automacally update desktop window */
    GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0);

    while(1)
    {
        GUI_Delay(100);
    }

}
1.png
回复

使用道具 举报

16

主题

27

回帖

75

积分

初级会员

积分
75
 楼主| 发表于 2013-7-13 15:53:00 | 显示全部楼层

回 eric2013 的帖子

eric2013:给你写了一个代码,研究一下

#include <stddef.h>
#include "GUI.h"
#include "DIALOG.h"
....... (2013-07-12 17:56) 
3Q 你的方法 解决了 。。。
回复

使用道具 举报

4

主题

39

回帖

130

积分

初级会员

积分
130
发表于 2013-7-15 10:56:08 | 显示全部楼层
学习了
回复

使用道具 举报

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

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-10 20:07 , Processed in 0.328774 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

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