Jump to content

Kirill

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Kirill

  1. I found if I try to assign only "down" button:

    gwinAttachToggle(ghList1, BUTTON_ENTER, 0)

    Without assign "up" button. Click actually does not works. (Inside code I found that GLIST_FLG_SELECTED assign from element 0 to element1 but at the same time event "up" emitted too and it moves select flag from element 1 to element 0).

     

    It works correctly only if I assign both button:

    gwinAttachToggle(ghList1, BUTTON_ENTER, 0)
    gwinAttachToggle(ghList1, BUTTON_ESC, 1)

     

  2. I think example should be like this:

    static void createWidgets(void) {
    	GWidgetInit	wi;
            gwinWidgetClearInit(&wi);
    
    	// Apply the list parameters
    	wi.g.width = 200;
    	wi.g.height = 100;
    	wi.g.y = 10;
    	wi.g.x = 10;
    	wi.text = "List Name";
     
    	// Create the actual list
    	ghList1 = gwinListCreate(NULL, &wi, FALSE);
    }
  3. Hi, I figured out some strange behaviour 

    I tried to do example from here https://wiki.ugfx.io/index.php/List

    In example:

    static void createWidgets(void) {
    	GWidgetInit	wi;
     
    	// Apply some default values for GWIN
    	wi.customDraw = 0;
    	wi.customParam = 0;
    	wi.customStyle = 0;
    	wi.g.show = FALSE;
     
    	// Apply the list parameters
    	wi.g.width = 200;
    	wi.g.height = 100;
    	wi.g.y = 10;
    	wi.g.x = 10;
    	wi.text = "List Name";
     
    	// Create the actual list
    	ghList1 = gwinListCreate(NULL, &wi, FALSE);
    }

    There are no wi.g.parent set.

    So during initialisation we add widget to windowManager using this function:

    bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit) {
    	#if GWIN_NEED_CONTAINERS
    		// Save the parent
    		gh->parent = pInit->parent;
    
    		// Ensure the display is consistent with any parents
    		if (gh->parent && (!(gh->parent->flags & GWIN_FLG_CONTAINER) || gh->display != gh->parent->display))
    			return FALSE;
    	#endif
    
    	// Add to the window manager
    	if (!_GWINwm->vmt->Add(gh, pInit))
    		return FALSE;
    
    	#if GWIN_NEED_CONTAINERS
    		// Notify the parent it has been added
    		if (gh->parent && ((gcontainerVMT *)gh->parent->vmt)->NotifyAdd)
    			((gcontainerVMT *)gh->parent->vmt)->NotifyAdd(gh->parent, gh);
    	#endif
    
    	return TRUE;
    }

    Look at this condition:

    if (gh->parent && (!(gh->parent->flags & GWIN_FLG_CONTAINER) || gh->display != gh->parent->display))
    			return FALSE

    If parent not NULL it started to check display and display not equal (actually it is just a trash)

    To fix that behaviour need to clean parent (wi.g.parent = NULL;)

    I think we should have function to clean Widget structure before initialise.

×
×
  • Create New...