lpcware

OWN GUI creation...Probelm with dynamic memory allocation

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by lpc_learner on Thu Apr 12 02:54:47 MST 2012
hi everybody,
I know that there are several GUI are available with free of cost, but i am just creating my own gui with a small set of widgets. Up to now i managed to create the drawings of widgets. Now, i've to add the properties of each widget. so that i am creating a structure for each widget to store the properties.like this..


// structure for edit text widget
typedef struct{

int iLocX;
int iLocY;

const unsigned char* string;  // to store the string which i am going to display in my edit text widget


}edit_text_widget;


create_edit_text_widget(int locX,locY,char* name,unsigned char* str_to_display)
{
edit_text_widget* edit_text_info;

draw_editWidget(iLocX,iLocY);

edit_text_info = (edit_text_widget*)malloc(sizeof(edit_text_info));

// with out above statement my widget is printing on TFT..but,
// with this statement, TFT is not at all intialising..controll is not all coming to main function itself

}


how to allocate the memory for this structure...If any doubts on this question,let me know..
If any one get this, please help me out...

Sorry for poor English..

Thanks in advance..

Outcomes