Jump to content

Vadim1980

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by Vadim1980

  1. I trying to use in my home project cyrilic font, but its not work for me.

    Is somebody explain me how to use such font by view words?

    - What font I have to use for this.

    - I have to

    #define MF_ENCODING MF_ENCODING_ASCII

     

    ----

    Something wrong with my project or settings and library shows bugs on the screan and not latter

  2. 17 hours ago, Joel Bodenmann said:

    You should be able to make the container larger than the display and then move it with `gwinMove()`.


    Alternatively, you might want to use the List widget which already implements proper scrolling: https://wiki.ugfx.io/index.php/List
    Note that this widget can be heavily customized to fit your needs. There is an example on the forum showing how to use it for an icon grid.

    Thank you, I am already use it. But I want to use Lable with TextEdit like List Item element, may by later I will try to make it but now I try to use container

  3. //=============================================
    //In the main.c
    //=============================================
    void GfxTestTask(void *pvParameters) {

      GEvent *pe;
      gFont wFont;

      gfxInit();

      // Set the widget defaults
      wFont = gdispOpenFont(fontName);   //GOST_UI_215
      gwinSetDefaultFont(wFont);   //"UI2"
      gwinSetDefaultStyle(&CustomWidgetStyle, gFalse);

      GHandle ghEdit1 = createEditTextKey4x5("Edit1_4x5", 180, 22, 60, 20, 16);

      ghList1 = createListCheckbox("List1Checkbox", 64, 2, 110, 61);

        gwinAttachToggle(ghList1, 0, 1);//down //2
        gwinAttachToggle(ghList1, 1, 2);//up //4
        gwinAttachToggle(ghList1, 2, 3);//checked //8
        gwinAttachToggle(ghList1, 3, 4);//checked //8
    }

    //=============================================
    ginput_lld_toggle_Pal.c
    //=============================================

    void ginput_lld_toggle_init(const GToggleConfig *ptc) {
      //palSetGroupMode(((IOBus *)ptc->id)->portid, ptc->mask, 0, ptc->mode);
    }

    //This is just for testing mode
    //I have generate button pressing
    unsigned ginput_lld_toggle_getbits(const GToggleConfig *ptc) {
      volatile unsigned int res = 0;
      if (g_test_button_event_counter++ > 40) {
        g_test_button_event_counter = 0;
      }

      switch (g_test_button_event_counter) {
        case 10:
          res = 8; //(1 << 3) - bit in the port
          break;
        case 20:
          res = 4; //(1 << 2) - bit
          break;
        case 40:
        case 50:
          res = 2;
          break;
        default:
          res = 0;
      }
      return res;
    }

    //============================================
    //it is my new component, it is just copy from list.c
    //list_checkbox.c
    //I add role number 3
    //============================================
    // a toggle-on has occurred
    static void ListCheckboxToggleOn(GWidgetObject *gw, gU16 role) {
      const gfxQueueASyncItem *qi;
      const gfxQueueASyncItem *qix;
      int i;

      gCoord iheight;
      gCoord iwidth;
      iheight = gdispGetFontMetric(gw->g.font, gFontHeight) + LST_CHECKBOX_VERT_PAD;
      switch (role) {
        // select down
        case 0:
          for (i = 0, qi = gfxQueueASyncPeek(&gw2obj->list_head); qi; qi = gfxQueueASyncNext(qi), i++) {
            if ((qi2li->flags & GLIST_FLG_SELECTED)) {
              qix = gfxQueueASyncNext(qi);
              if (qix) {
                qi2li->flags &= ~ GLIST_FLG_SELECTED;
                qix2li->flags |= GLIST_FLG_SELECTED;

                //if we need to scroll down
                if (((i + 2) * iheight - gw2obj->top) > gw->g.height) {
                  gw2obj->top += iheight;
                }

                _gwinUpdate(&gw->g);
              }
              break;
            }
          }
          break;

          // select up
        case 1:
          qi = gfxQueueASyncPeek(&gw2obj->list_head);
          qix = 0;

          for (i = 0; qi; qix = qi, qi = gfxQueueASyncNext(qi), i++) {
            if ((qi2li->flags & GLIST_FLG_SELECTED)) {
              if (qix) {
                qi2li->flags &= ~ GLIST_FLG_SELECTED;
                qix2li->flags |= GLIST_FLG_SELECTED;

                if (((i - 1) * iheight) < gw2obj->top) {
                  gw2obj->top -= iheight;
                  if (gw2obj->top < 0)
                    gw2obj->top = 0;
                }

                _gwinUpdate(&gw->g);
              }
              break;
            }
          }
          break;
        case 2://This one
          qi = gfxQueueASyncPeek(&gw2obj->list_head);
          qix = 0;

          for (i = 0; qi; qix = qi, qi = gfxQueueASyncNext(qi), i++) {
            if ((qi2li->flags & GLIST_FLG_SELECTED)) {
              qi2li->flags ^= GLIST_FLG_CHECKED;
              if (qi2li->keyActions.Enter.keyFunct) {
                qi2li->keyActions.Enter.keyFunct(1, gTrue);
              }
              _gwinUpdate(&gw->g);
              break;
            }
          }
          break;
      }
    }

    static void ListCheckboxToggleAssign(GWidgetObject *gw, gU16 role, gU16 instance) {
      if (role == 1)
        gw2obj->t_up = instance;
      else if (role == 0)
        gw2obj->t_dn = instance;
      else if (role == 2)
        gw2obj->t_check = instance;//This one
    }

    static gU16 ListCheckboxToggleGet(GWidgetObject *gw, gU16 role) {
      if (role == 1)
        return gw2obj->t_up;
      else if (role == 0)
        return gw2obj->t_dn;
      else if (role == 2)
        return gw2obj->t_check;//This one

    }

×
×
  • Create New...