Crowdsourced GUI. Open beta testing. - page 24

 

I reread the whole thread again, and saw many examples of how "the interface is designed in a markup language". But I didn't see a single example from Peter that showed exactly how the "interface code" would interact with the developer's main program.

Nikolai and I have tried several times to reduce Peter to this topic, but nowhere did I see any example code for the interaction between the main program and the GUI.

I also came across the expression "print code" several times while reading the thread. Piotr, what is the meaning of this phrase? I think there is even such a command in Petr's "vigin" ..... Why print code? Why can't it be saved to a text file with the right name and in the right place?

Peter, don't rush out the visualizer, let's deal with the applicability of your suggestion in a general context.

That is, draw a form with a couple of buttons, with a combobox, with a couple of checkboxes and with an input field. For now, how to refer to these controls in procedural code, give them values and get values from them.

Once you've got that sorted out, you'll move on.

 
Алексей Барбашин:

I reread the whole thread again, and saw many examples of how "the interface is designed in a markup language". But I didn't see a single example from Peter that showed exactly how the "interface code" would interact with the developer's main program.

Nikolai and I have tried several times to reduce Peter to this topic, but nowhere did I see any example code for the interaction between the main program and the GUI.

I also came across the expression "print code" several times while reading the thread. Piotr, what is the meaning of this phrase? I think there is even such a command in Petr's "vigin" ..... Why print code? Why can't it be saved to a text file with the right name and in the right place?

Peter, don't rush out the visualizer, let's deal with the applicability of your suggestion in a general context.

That is, draw a form with a couple of buttons, with a combobox, with a couple of checkboxes and with an input field. For now, how to refer to these controls in procedural code, give them values and get values from them.

As soon as you figure it out, you will move on.

Find Oleg Papkov's profile. I made him an 11-window gui with lots of different elements in the markup language, a year ago. Everything works. He knows better than anyone what he's talking about. I'm very busy at the moment.

@Oleg Papkov

AndAlexandr Atagyan(here's his panel)

 

Here is the connection file for this panel. Found it after all.

Files:
 

This file contains functionality for calling controls, retrieving their values, setting values and states. The functionality is standard and the user does not need to look into the file.

Files:
 
Реter Konow:

Here is the connection file for this panel. Found it after all.

I didn't see any interaction between the main program and the interface in this code. Apparently we speak completely different languages.

 
Алексей Барбашин:

I didn't see any interaction between the main programme and the interface in this code. Apparently we speak completely different languages.

I don't have the main program. The people to whom I made these interfaces have it. The GUI was connected to their program(whose code I haven't seen at all) via resources. And now, the connection will be integrated inside. I.e. it will work without resources. Directly.

 
Реter Konow:

I don't have the main programme. The people to whom I made these interfaces have it. The GUI was connected to their program(whose code I haven't seen at all) via resources. And now, the connection will be integrated inside. I.e. it will work without resources. Directly.

That's not exactly how it works. You're making a visual interface editor. The visual part of your application is exactly the GUI that your application creates. And what is done "behind the scenes", how the new GUI texts are created, is the main program.

But since you have your own view of programming.....

 
Алексей Барбашин:

That's not quite right. You are making a visual interface editor. The visual part of your application is exactly the GUI that your application creates. And what is done "behind the scenes", how the texts of the new GUI are created, is the main program.

But since you have your own view of programming.....

We have a huge divergence of views, Alexey. It's better to leave it at that. You can't find a common language right away and it takes a lot of time. I'll finish the minimal version and you'll see for yourself. I'll try to get it done by the day after tomorrow.

 
Алексей Барбашин:

I didn't see any interaction between the main programme and the interface in this code. Apparently we speak completely different languages.

I think that's what you mean:

void SMSG(string par0 = "0", string par1 = "0", string par2 = "0", string par3 = "0")
{
 
 SEND send; uint i1 = 0;
 if(par0 != "0"){MSG += par0 + "`" + par1 + "`" + par2 + "`" + par3 + "~";}
 if(MSG != NULL && (par0 == (string)DRIVE_IS_READY || GUI_ЗАГРУЖЕН))
   {
 
    StringToCharArray(MSG,send.char_Send);
    ResourceCreate("::DRIVE_2_EA",send.uint_Send,8000,1,0,0,0,COLOR_FORMAT_XRGB_NOALPHA);
    //ArrayInitialize(send.char_Send,0);
    while(send.uint_Send[i1]){send.uint_Send[i1] = 0; i1++;}
    MSG = NULL;
   } 
}
//--------------------------------------------------------------------

//--------------------- -----------------------------------------------
void RMSG(bool Internal_message = 0)
{
 READ read; uint width,height, i1 = 0; string msg[], pars[]; bool q1 = 0,q2 = 0,q3 = 0;bool t = 0; string msg2read = NULL;
 int Номер_колонки = 0,T_header = 0,Программный_вызов = 0,Элемент = 0;
 read.uint_Read[0] = 0;
 //------------------------------------------------------------------------------------
 EA_ADRESS = ObjectGetString(0,"EA_2_DRIVE",OBJPROP_TEXT);
 
 //------------------------------------------------------------------------------------
 if(!Internal_message)t = ResourceReadImage(EA_ADRESS + "::EA_2_DRIVE",read.uint_Read,width,height);

 if(read.uint_Read[0] || Internal_message)
   { 
    int cnvs[100];
    int cnvs_2[100];
    //--------------------------------------
    ArrayInitialize(cnvs,0);
    ArrayInitialize(cnvs_2,0);
    //--------------------------------------
    Не_рисовать = 1;
    int Полная_перерисовка_канваса = 0;
    //--------------------------------------
    if(!Internal_message)msg2read = CharArrayToString(read.char_Read);
    else                 msg2read = i_MSG;
    //---------------------------------------------------------------------   
    ushort Msep = StringGetCharacter("~",0);
    int s = StringSplit(msg2read,Msep,msg);
    //---------------------------------------------------------------------    
    for(int a1 = 0; a1 < s; a1++)
      {
       ushort Psep = StringGetCharacter("`",0);
       int   w1   = StringSplit(msg[a1],Psep,pars);
       //--------------------------------------
       if(w1)
       {
       //------------------------------------------------------------------
       if((int)pars[0] == INIT_GUI && !GUI_ЗАГРУЖЕН)
         {
          Загрузить_GUI();         
         }        
       //--------------------------------------------------  
       if(GUI_ЗАГРУЖЕН)
       {
       if((int)pars[0] == M_COLOR)
         {
          G_CORE[(int)pars[1]][G_CORE[(int)pars[1]][_CURRENT_STATE]] = (int)pars[3];
          //---------------------------------------------
          G_CORE[(int)pars[1]][_REDROW] = 1;
          q1 = 1;  
         } 
       //------------------------------------------------------------------- 
       if((int)pars[0] == T_COLOR)
         {
          G_CORE[G_CORE[(int)pars[1]][_HIS_TEXT]][G_CORE[(int)pars[1]][_CURRENT_STATE]] = (int)pars[3];
          //---------------------------------------------
          if(!G_CORE[(int)pars[1]][_PARAMETER])
            {
             G_CORE[(int)pars[1]][_REDROW] = 1;
             q1 = 1;
            } 
          else
            {
             G_CORE[(int)pars[1]][_REDROW] = 2;
             q2 = 1;
            }      
         }
       //-------------------------------------------------------------------
       if((int)pars[0] == F_COLOR)
         {
          int Состояние_элемента = G_CORE[(int)pars[1]][_CURRENT_STATE];
          if(!Состояние_элемента)Состояние_элемента = _NEUTRAL_STATE;
          //---------------------------------------------
          switch(Состояние_элемента)
           {
            case _NEUTRAL_STATE:           G_CORE[(int)pars[1]][_N_FRAME_COLOR]  = (int)pars[3]; break;
            case _NEUTRAL_HIGHLIGHTED:     G_CORE[(int)pars[1]][_NH_FRAME_COLOR] = (int)pars[3]; break;
            case _ACTIVATED_STATE:         G_CORE[(int)pars[1]][_A_FRAME_COLOR]  = (int)pars[3]; break;
            case _ACTIVATED_HIGHLIGHTED:   G_CORE[(int)pars[1]][_AH_FRAME_COLOR] = (int)pars[3]; break;
           } 
         //---------------------------------------------
          G_CORE[(int)pars[1]][_REDROW] = 1;
          q1 = 1;
        }
      //-------------------------------------------------------------------
      if((int)pars[0] == STATE)
        {
         G_CORE[(int)pars[1]][_CURRENT_STATE] = (int)pars[3];
         //---------------------------------------------
          G_CORE[(int)pars[1]][_REDROW] = 1;
          q1 = 1; 
        }
      //-------------------------------------------------------------------     
      if((int)pars[0] == DEST_GUI)
        {
         for(int s1 = 2; s1 < 500; s1++){if(Открыто_окно[s1])Явление_окон(s1,_WINDOW_CLOSE);} 
         Стереть_Edit();   
        }
      //------------------------------------------------------------------- 
      if((int)pars[0] == SET_VALUE_BY_MAGIC || (int)pars[0] == SORT_COLOMN)
        {
         Номер_колонки = (int)MathRound((int)pars[2]/100000);
         T_header      = (int)pars[2] - (Номер_колонки*100000);
         Элемент       = Элемент_по_T_header_и_колонке(T_header,Номер_колонки,(int)pars[1]);        
        }
      //-------------------------------------------------------------------       
      if((int)pars[0] == SET_VALUE_BY_MAGIC || (int)pars[0] == SORT_COLOMN || (int)pars[0] == DELETE_ROW || (int)pars[0] == DELETE_ALL_ROWS)
        {
         if((int)pars[0] != SORT_COLOMN)int _Канвас = G_CORE[T_header][_CANVAS];
         Программный_вызов          = 1;
        }
      //-------------------------------------------------------------------   
      if((int)pars[0] == SET_VALUE_BY_MAGIC)
        {  
         //--------------------------------------------------
        
         //--------------------------------------------------        
         if(!Элемент)
           {         
            Полная_перерисовка_канваса = 1;
            //--------------------
            Явление_рядов(NEW_ROW,T_header,(int)pars[1]);
            Элемент      = Элемент_по_T_header_и_колонке(T_header,Номер_колонки,(int)pars[1]);
           } 
         //--------------------------------------------------
         
         //--------------------------------------------------
         Контроль_значений_движка(Элемент, pars[3], 1);
         //-------------------------------------------------- 
        }
      //------------------------------------------------------------------- 
      if((int)pars[0] == SORT_COLOMN)
        {
         Явление_рядов(SORT_COLOMN,T_header,Номер_колонки,(int)pars[3]);
        }
      //-------------------------------------------------------------------
      if((int)pars[0] == DELETE_ROW)     
        {
         Явление_рядов(DELETE_ROW,(int)pars[2],(int)pars[1]);
        } 
      //-------------------------------------------------------------------  
      if((int)pars[0] == DELETE_ALL_ROWS)
        {
         Явление_рядов(DELETE_ALL_ROWS,(int)pars[2],(int)pars[1]);
        } 
      //-------------------------------------------------------------------
      if((int)pars[0] == SET_RANGE_N_STEP)
        {
         P_CORE[(int)pars[1]][_V_MIN]  = (string)pars[2];
         P_CORE[(int)pars[1]][_V_MAX]  = (string)pars[3];
         P_CORE[(int)pars[1]][_V_STEP] = (string)pars[4];
         P_CORE[(int)pars[1]][_DIGITS] = (string)pars[5];
        }
      //-------------------------------------------------------------------
      //ВЫСКАКИВАЕТ НА КАЖДОМ ОБРАЩЕНИИ К ФУНКЦИИ.
      //------------------------------------------------------------------  
      /*if((int)pars[0] == W_CAPTION)
        {Alert("(int)pars[0] == W_CAPTION");
         CONTENT[G_CORE[WND[(int)pars[2]]][_WINDOW_NAME]] = pars[1];
         CONTENT[G_CORE[G_CORE[WND[(int)pars[2]]][_CAPTION_OBJECT]][_N_TEXT]] = pars[1];
         //-----------------------------------------------------------------------------
         int Длинна_текста = 0,Высота_текста = 0;
         //------------------------------------------------
         if(!TextSetFont("Microsoft JhengHei Light",10 *-10,FW_NORMAL,0)){Alert("*",__FUNCTION__,"*","Ошибка настройки параметров шрифта! ",GetLastError());}  
         TextGetSize(pars[1],Длинна_текста,Высота_текста);
         //------------------------------------------------
         G_CORE[WND[(int)pars[2]]][_CAPTION_X_SIZE] = Длинна_текста;
         G_CORE[WND[(int)pars[2]]][_CAPTION_Y_SIZE] = Высота_текста;   
         G_CORE[G_CORE[WND[(int)pars[2]]][_CAPTION_OBJECT]][_TEXT_X_SIZE] = Длинна_текста;
         G_CORE[G_CORE[WND[(int)pars[2]]][_CAPTION_OBJECT]][_TEXT_Y_SIZE] = Высота_текста;                       
         //------------------------------------------------
         Объект((int)pars[2]);
         Нарисовать_элемент(WND[(int)pars[2]] + 1,REDROW_WHOLE_CANVAS);
        }  */
      //-------------------------------------------------------------------       
      Программный_вызов = 0;
      //-------------------------------------------------------------------
      if((int)pars[0] == _SYNC_P_CORE)
        {
         if(!Internal_message)Контроль_значений_движка((int)pars[1], pars[3], 1);
         else                 Контроль_значений_движка((int)pars[1], pars[3]);
         q2 = 1;   
        } 
      //------------------------------------------------------------------- 
      if((int)pars[0] == OPEN_WINDOW) Явление_окон((int)pars[1],_WINDOW_OPEN,NULL);         
      if((int)pars[0] == CLOSE_WINDOW)Явление_окон((int)pars[1],_WINDOW_CLOSE,NULL);  
      //-------------------------------------------------------------------   
      if((int)pars[0] == ONLY_READ)G_CORE[(int)pars[1]][_READ_ONLY] = (int)pars[3];
      //=========================================================================================      
      
      //=========================================================================================          
      int Канвас = G_CORE[(int)pars[1]][_CANVAS];
      if((int)pars[0] == SET_VALUE_BY_MAGIC || (int)pars[0] == SORT_COLOMN)Канвас = G_CORE[Элемент][_CANVAS];
      //----------------------------------------------
      for(int r6 = 0; r6 < 100; r6++)
        { 
         if(cnvs[r6] == Канвас)break; 
         //--------------------------
         if(!cnvs[r6])
           {
            cnvs[r6]   = Канвас;
            cnvs_2[r6] = REDROW_CHANGED_ELEMENTS;
            //-----------------------------------
            if(Полная_перерисовка_канваса)
              {
               cnvs_2[r6] = REDROW_WHOLE_CANVAS;
               Полная_перерисовка_канваса = 0;
              } 
            //----------------------------------- 
            break;
           }
         //--------------------------
        }
       //=========================================================================================
       
       //=========================================================================================  
       
       //========================================================================================= 
        }
      } 
    }
    //------------------------------------------------------------------------------------------------------- 
    if(!q1 && q2)q3 = 1;
    else q3 = 0;
    //-------------------------------------------------------------------------------------------------------
    for(int f1 = 0; f1 < 100; f1++)
      {
       if(!cnvs[f1])break;
       if(Открыто_окно[G_CORE[cnvs[f1]][_WS_NUMBER]] && !G_CORE[cnvs[f1]][_HIDE] && cnvs_2[f1] == REDROW_CHANGED_ELEMENTS)
         {
          Нарисовать_элемент(cnvs[f1],REDROW_CHANGED_ELEMENTS);
         } 
       if(cnvs_2[f1] == REDROW_WHOLE_CANVAS)
         {
          Установить_параметры_прокрутки(cnvs[f1]);
          //----------------------------------------------------------
          //Перерисовываем канвас V_BOX-а.
          //----------------------------------------------------------
          Нарисовать_элемент(G_CORE[G_CORE[cnvs[f1]][_MAIN]][_CANVAS],G_CORE[cnvs[f1]][_MAIN]);
          //----------------------------------------------------------
          //Перерисовываем весь канвас.
          //----------------------------------------------------------    
          Нарисовать_элемент(cnvs[f1],REDROW_WHOLE_CANVAS);
          //---------------------------------------------------------- 
         }
      }
    i1 = 0;  
    //-------------------------------------------------------------------------------------------------------
    if(!Internal_message)while(read.uint_Read[i1]){read.uint_Read[i1] = 0; i1++;} 
    //ArrayInitialize(read.char_Read,0);
    //ResourceCreate("::EA_2_DRIVE",read.uint_Read,8000,1,0,0,0,COLOR_FORMAT_XRGB_NOALPHA);
    //-------------------------------------------------------------------------------------------------------
    Не_рисовать = 0;
   // MSG = NULL;
    i_MSG = NULL;
    //-------------------------------------------------------------------------------------------------------      
   }
   
}

These are the two functions that allow the GUI to "communicate" with the program. They receive messages, decrypt them and forward them to either the elements or the programme.

 
Реter Konow:

I think that's what you meant:

These are the two functions that ensure the GUI "communicates" with the programme. They receive messages, decrypt them and forward them to either the elements or the program.

This is a masterpiece :)

Открыто_окно[G_CORE[cnvs[f1]][_WS_NUMBER]]

If something needs to be redone/done, in a week you won't remember what relates to what.

Reason: