cancel
Showing results for 
Search instead for 
Did you mean: 

TFT LCD touch screen mapping by external keypad

Tran Minh Cong
Associate II
Posted on July 12, 2018 at 07:02

Dear every body,

I'm doing project about lcd tft 7inch 800x480 and stm32f746.

Currently, i want use external keypad (or external button), not use touch screen pannel.

Example: 

http://hshop.vn/products/ban-phim-ma-tran-mem-4x4

 

I have 1 button on LCD:

// { BUTTON_CreateIndirect, 'Browse', ID_BUTTON_0, 13, 8, 100, 20, 0, 0x0, 0 },

(x,y) =  (13,8).

width = 100.

height = 20.

=> (x,y) center = (13+100/2 = 63,8+20/2=18).

When 1 keypad or button pressed, i checked that ok.

How to mapping 1 key pressed to WM_NOTIFICATION_CLICKED event of 

ID_BUTTON_0 (ID_BUTTON_0 is displayed on LCD)? After that, emwin will do something: show dialog...

Can you tell me solutions, please?

Thank you so much!

#tft-lcd-touch-screen-mapping-by-external-keypad
39 REPLIES 39
Tran Minh Cong
Associate II
Posted on July 13, 2018 at 07:37

Publish your project

Tran Minh Cong
Associate II
Posted on July 13, 2018 at 09:51

Oh, many thanks. 

Next step, i'm hearing you tell me about:

'Up/Down button to up/down file name in list file on TREEVIEW.

Ok button to select file (name of hItem to next funtion).'

Posted on July 13, 2018 at 10:11

I would make it easier

I would create three buttons with names file1 file2 file3 

& and would emulate their pressing

Posted on July 13, 2018 at 09:02

I can not open your  

WindowDLG_Test.c. 

using the program GUIBuilder.

You must modify this file only insert your code only between

// USER START

.....your code

// USER END

Tran Minh Cong
Associate II
Posted on July 13, 2018 at 11:04

Dear you,

When you finish code, you please update link for me.

Thank you.

Posted on July 13, 2018 at 09:44

I correct your file by add this 

//

// Initialization of 'USB'

//

hItem = WM_GetDialogItem(pMsg->hWin, ID_TREEVIEW_0);

hTreeItemCur = TREEVIEW_GetItem(hItem, 0, TREEVIEW_GET_LAST);

hTreeItemNew = TREEVIEW_ITEM_Create(TREEVIEW_ITEM_TYPE_NODE, ' file1.txt', 0);

TREEVIEW_AttachItem(hItem, hTreeItemNew, hTreeItemCur, TREEVIEW_INSERT_BELOW);

hTreeItemCur = TREEVIEW_GetItem(hItem, 0, TREEVIEW_GET_LAST);

hTreeItemNew = TREEVIEW_ITEM_Create(TREEVIEW_ITEM_TYPE_NODE, ' file2.txt', 0);

TREEVIEW_AttachItem(hItem, hTreeItemNew, hTreeItemCur, TREEVIEW_INSERT_BELOW);

hTreeItemCur = TREEVIEW_GetItem(hItem, 0, TREEVIEW_GET_LAST);

hTreeItemNew = TREEVIEW_ITEM_Create(TREEVIEW_ITEM_TYPE_NODE, ' file3.txt', 0);

TREEVIEW_AttachItem(hItem, hTreeItemNew, hTreeItemCur, TREEVIEW_INSERT_BELOW);

hTreeItemCur = TREEVIEW_GetItem(hItem, 0, TREEVIEW_GET_LAST);

hTreeItemNew = TREEVIEW_ITEM_Create(TREEVIEW_ITEM_TYPE_NODE, ' file4.txt', 0);

TREEVIEW_AttachItem(hItem, hTreeItemNew, hTreeItemCur, TREEVIEW_INSERT_BELOW);

//

// Initialization of 'OK'

//
Tran Minh Cong
Associate II
Posted on July 13, 2018 at 11:49

Dear you, 

I have finished 

treeview_up() function. It is ok.

My code:

void treeview_up(void) {

WM_HWIN hTree0;

TREEVIEW_ITEM_Handle hTVI0, hTVI1;

hTree0 = WM_GetDialogItem(WM_GetFirstChild(WM_HBKWIN), ID_TREEVIEW_0);

hTVI0 = TREEVIEW_GetSel(hTree0);

if (hTVI0) {

hTVI1 = TREEVIEW_GetItem(hTree0, hTVI0, TREEVIEW_GET_PREV_SIBLING);

if (hTVI1) {

TREEVIEW_ITEM_Detach(hTVI0);

TREEVIEW_AttachItem(hTree0, hTVI0, hTVI1, TREEVIEW_INSERT_ABOVE);

TREEVIEW_SetSel(hTree0, hTVI0);

} else {

GUI_MessageBox('Item is already on top!', 'Info',

GUI_MESSAGEBOX_CF_MODAL);

WM_SetFocus(hTree0);

}

}

}

How to check, get text content in treeview hItem? 'file1.txt', 'file2.txt', 'file3.txt' or 'file4.txt'

char* treeview_select_file(void){

char* s_file;

WM_HWIN hTree0;

TREEVIEW_ITEM_Handle hTVI0;

TREEVIEW_ITEM_INFO ItemInfo;

hTree0 = WM_GetDialogItem(WM_GetFirstChild(WM_HBKWIN), ID_TREEVIEW_0);

hTVI0 = TREEVIEW_GetSel(hTree0);

if (hTVI0) {

TREEVIEW_ITEM_GetInfo(hTVI0, &ItemInfo);

if(ItemInfo.IsNode == 0){//Khong phai node

//do something to copy file name to s_file???

}

}

}
Posted on July 13, 2018 at 10:08

Buttons must emulate pressed on 

TREEVIEW area

Tran Minh Cong
Associate II
Posted on July 13, 2018 at 14:03

Dear Vitaliy Chernobay,

I have other question, i need your helps.

Content:

- I have 3 icon (circle, rectangle, triangle) image .png, .jpg, .bmp...I show on 'window dialog' or 'framewin dialog'.

Dimension of icon about 100x100 pixel.

When I get event up/down from external button, 

circle/rectangle/triangle iamge will be selected.

ok event to select current to next funtion.

Can you tell me about solutions to do that?

Thank you!