EnglishРусский  

   ..

   btnsys.g

   funcs.g

   gena.g

   gfe.g

   visedit.g

   viseditor.g

   viseditor.gi

   winedit.g

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

source\programs\visedit\viseditor.g
   1 define {
   2    DESIGNING = 1
   3 }
   4 include {
   5    
   6    "..\\..\\lib\\vis\\app.g"
   7    "..\\..\\lib\\vis\\btn.g"
   8    "..\\..\\lib\\vis\\panel.g"
   9    "..\\..\\lib\\vis\\edit.g"
  10    "..\\..\\lib\\vis\\menu.g"
  11    "..\\..\\lib\\vis\\popupmenu.g"
  12    "..\\..\\lib\\vis\\tab.g"
  13    "..\\..\\lib\\vis\\combobox.g"
  14    "btnsys.g"
  15    "winedit.g"
  16    "proplist.g"
  17 }
  18 /*include {   
  19    "complib.g"
  20 }*/
  21 extern {
  22 //func delcompdes(vComp comp)
  23 func vComp newcompdes( uint typeid, vComp owner )
  24 }
  25 /*include {
  26    "form.g"
  27    "btn.g"
  28    "panel.g"   
  29    "winedit.g"
  30    "edit.g"   
  31 //   "vCompman.g"
  32    "vPropList.g"
  33    "gt.ge"
  34    "btnsys.g"
  35    //"listbox.g"
  36    //"popuplist.g"
  37    "tab.g"
  38    "gena.g"
  39 }*/
  40 
  41 //FORMEDITOR SECTION START
  42 //
  43 type evdesc{
  44 uint idmethod //Идентификатор метода
  45 str  name     //Имя метода 
  46 str  evtype   //Тип параметра сообщения
  47 uint events //Количество подключенных компонентов
  48 }
  49 
  50 type myform <inherit=vForm>
  51 {
  52    int cur
  53    //vPanel panleft
  54    //vPanel panowner
  55    vBtn bt_arrow
  56    vBtn bt_btn   
  57    vBtn bt_panel
  58    vBtn bt_edit   
  59    vBtn bsave
  60    vBtn bopen 
  61    vBtn babout 
  62    vEdit edcur
  63    
  64     vPanel panright 
  65     uint prl
  66     uint evl
  67     arr  evlist of evdesc 
  68     uint curidmethod
  69     
  70     str srcfile
  71     //arr  incllist
  72    //vBtn btn1
  73    //vBtn btn2
  74    //vBtn btn3
  75    //vBtn btn4
  76 //USER DEFINED START
  77    //Здесь можно добавлять свои поля
  78 //USER DEFINED STOP   
  79 }
  80 
  81 
  82 global
  83 { 
  84    myform myform1
  85    uint edform 
  86    uint wined
  87 //   uint bthorz
  88 //   uint btvert
  89 //   uint ed_name
  90 //   uint ed_cap
  91    uint inspm
  92    uint plist   
  93 }
  94 //FORMEDITOR SECTION END
  95 
  96 method myform.btn1_click()
  97 {   
  98  //  msg_info("Right Button click", "Test2")
  99    //this.btn1.x = 100
 100    //this.btn1.x = this.btn1.x + int(10)
 101    
 102    //newcomp( vForm, this )
 103 /*SCROLLINFO sci
 104    sci.cbSize = sizeof( SCROLLINFO )
 105    sci.nPos = 10
 106    sci.fMask = 0x04 | 0x0001
 107    //sci.nTrackPos   
 108    SetScrollInfo( this.hwnd, 1, sci, 1) */
 109    ScrollWindowEx( this.hwnd, 100, 100, 0, 0, 0, 0, 1 )
 110 }
 111 
 112 method str myform.getnewname<result>( str vtypename )
 113 {
 114    uint curn
 115    str typename 
 116    if *vtypename > 1 
 117    {
 118       typename.substr( vtypename, 1, *vtypename-1 )
 119    }
 120    else
 121    {
 122       typename = vtypename
 123    }
 124    do
 125    {
 126       result = typename + "\(curn++)"      
 127    }
 128    while &(edform->vComp.FindComp( result ))   
 129 }
 130 
 131 method str myform.getinclude <result> ()
 132 {
 133    result = "include { \"complib.ge\"
 134 \"btn.g\"
 135 \"panel.g\"
 136 \"edit.g\""
 137 }
 138 
 139 method str vCtrl.listctrl <result>
 140 {  
 141    uint i
 142    fornum i=0, *this.ctrls
 143    {
 144       result@"\t"@this.ctrls[i]->vCtrl.TypeName@"\t"@this.ctrls[i]->vCtrl.Name@"\n"
 145       result@this.ctrls[i]->vCtrl.listctrl()
 146    }
 147 }
 148 
 149 method str myform.getform <result> ()
 150 {
 151    result = "type v\(edform->vCtrl.Name) <inherit=vForm> {
 152 \(edform->vCtrl.listctrl()) "
 153 }
 154 
 155 
 156 func uint replcode( str a, str b, str c)
 157 {
 158 return 1
 159 }
 160 func uint replcode( str a, str b, str c, str d)
 161 {
 162 return 1
 163 }
 164 func uint inscode( str a, str b, str c, str d)
 165 {
 166 return 1
 167 }
 168 
 169 method myform.setheader( str src )
 170 {    
 171    src.read( this.srcfile + ".gf" )   
 172    if !replcode( src, "include", this.getinclude() ) : print( "ERROR\n" )   
 173    if !replcode( src, "form", this.getform() ) : print( "ERROR\n" )
 174    src.write( this.srcfile + ".gf" )
 175 }
 176 
 177 method myform.setheaderf()
 178 { 
 179    str src 
 180    src.read( this.srcfile + ".gf"  )
 181    this.setheader( src )
 182    src.write( this.srcfile + ".gf"  )
 183 }  
 184 
 185 method myform.setmethod( str src, str oldname, newname, typename )
 186 {   
 187    str labo = "method \( oldname ) \( typename )"
 188    str labn = "method \( newname ) \( typename )"
 189    str code = "method uint v\(edform->vCtrl.Name).\(newname)( \(typename) evn )"      
 190    if !replcode( src, labo, labn, code )  
 191    {
 192       inscode( src, labn, code, "{\l\lreturn 0\l}\l" )
 193    }
 194 }
 195 
 196 method myform.setmethodf( str oldname, newname, typename )
 197 {
 198    str src
 199    src.read( this.srcfile + ".gf" )   
 200    this.setmethod( src, oldname, newname, typename )
 201    src.write( this.srcfile + ".gf" )
 202 }
 203 
 204 method myform.setall
 205 {
 206    str src
 207    src.read( this.srcfile + ".gf" )   
 208    
 209    this.setheader( src )
 210    /*fornum 
 211    {
 212       setmethod( ) 
 213    }*/
 214    src.write( this.srcfile + ".gf" )
 215 }
 216  
 217 method myform.setnew
 218 {
 219    str src
 220    src@"/*	
 221  //!GFG и //!\\GFG  are commentary attributes generated by 
 222  the Gentee form editor. You should neither delete them 
 223  nor make any changes into the source code from the beginning 
 224  of the commentary attribute //!GFG to its end //!\\GFG
 225 */
 226 "
 227    inscode( src, "include", this.getinclude(), "\l}\l" )
 228    inscode( src, "form", this.getform(), "\l}\l" )     
 229    src.write( this.srcfile + ".gf" )   
 230 }
 231 
 232       
 233 method vCtrl myform.newctrl( uint typeid )
 234 {    
 235    uint b = &newcompdes( typeid, ?( wined->vVEEdit.winn, wined->vVEEdit.winn->vCtrl, edform->vCtrl ) )   
 236    b as vCtrl
 237    if &b
 238    {  
 239       b.HorzAlign = $alhLeft
 240       b.VertAlign = $alvTop      
 241       b.Name = this.getnewname( b.TypeName )
 242       this.setheaderf()      
 243    }
 244    return b
 245 }
 246 
 247 method myform.wineditnew( eventpos eu )
 248 {    
 249    uint typeid 
 250    switch wined->vVEEdit.flgadd {
 251       case 1 : typeid = vBtn
 252       case 2 : typeid = vPanel
 253       case 3 : typeid = vEdit
 254    
 255    }
 256    uint b as this.newctrl( typeid )
 257    if &b
 258    {
 259       b.Left = eu.loc.left
 260       b.Top = eu.loc.top
 261       if eu.loc.width : b.Width = eu.loc.width
 262       if eu.loc.height : b.Height = eu.loc.height      
 263       switch wined->vVEEdit.flgadd {
 264       case 1 : b->vBtn.Caption = b.Name.ustr()
 265       case 2 : b->vPanel.Caption = b.Name.ustr()
 266       case 3 : b->vEdit.Text = b.Name.ustr() }
 267       this.bt_arrow.Checked = 1 
 268       wined->vVEEdit.select( b )
 269    }
 270    
 271    
 272  //  uint b as this.newctrl( vBtn )->vBtn
 273 }
 274 
 275 method myform.bt_btclick( eventn ev )
 276 {
 277    uint b as this.newctrl( vBtn )->vBtn
 278    if &b
 279    {
 280       b.Caption = "btn".ustr()
 281    }
 282    wined->vVEEdit.select( b )   
 283 }
 284 
 285 method myform.bt_panclick(eventn ev)
 286 {
 287    uint b as this.newctrl( vPanel )->vPanel
 288    if &b
 289    {
 290       b.Caption = "pan".ustr()
 291    }
 292    wined->vVEEdit.select( b )      
 293 }
 294 
 295 method myform.bt_edclick(eventn ev)
 296 {
 297    uint b as this.newctrl( vEdit )->vEdit
 298    if &b
 299    {
 300       b.Text = "edit".ustr()
 301    }
 302    wined->vVEEdit.select( b )
 303 }
 304 
 305 method myform.bt_delclick(eventn ev)
 306 {
 307    
 308    /*if wined->vVEEdit.winn && wined->vVEEdit.winn != edform
 309    {
 310       destroy( wined->vVEEdit.winn )
 311    }*/
 312 }
 313 
 314 method vCtrl.getproplist( arr ar of propl )
 315 {     
 316    ar.clear()   
 317    uint c as cm.findcomp( this.pTypeId )
 318    if &c 
 319    {
 320       ar.expand( *c.props )     
 321       //ar[i].ptype
 322       uint i
 323       fornum i=0, *c.props
 324       {         
 325          ar[i].name=c.props[i].name
 326          ar[i].value = c.props[i].getval( this )
 327          if ar[i].value == c.props[i].defval
 328          {
 329             ar[i].ptype |= $PTYPE_DEFVAL
 330          }      
 331          if c.props[i].vals : ar[i].ptype |= $PTYPE_LIST   
 332       }      
 333    }  
 334 }
 335 
 336 method uint myform.finddesc( uint id )
 337 {
 338    uint i
 339    fornum i, *this.evlist
 340    {
 341       if this.evlist[i].idmethod == id : return i
 342    }
 343    return -1
 344 }
 345 
 346 method uint myform.finddesc( str name, evtype )
 347 {
 348    uint i
 349    fornum i, *this.evlist
 350    {
 351       if this.evlist[i].name == name &&
 352          this.evlist[i].evtype == evtype  : return i
 353    }
 354    return -1
 355 }
 356 
 357 method myform.geteventlist( vCtrl ctrl, arr ar of propl )
 358 {
 359    ar.clear()   
 360    uint cd as cm.findcomp( ctrl.pTypeId )
 361    if &cd 
 362    {
 363       ar.expand( *cd.events )     
 364       uint i
 365       fornum i=0, *cd.events
 366       {         
 367          //print( "event+"+ cd.events[i].name+"\n" )
 368          ar[i].name=cd.events[i].name
 369          //uint evar as ctrl.des1->arr of uint
 370          uint idesc = this.finddesc( ctrl.des1->arr[i] )
 371          if idesc != -1
 372          {
 373             //print( "FIND \(i) \(idesc) \( this.evlist[idesc].name)\n" )
 374             ar[i].value = this.evlist[idesc].name
 375          }
 376       }      
 377    }
 378 }
 379 
 380 func vComp newcompdes( uint typeid, vComp owner )
 381 {
 382    //print( "newcomp start \n" )
 383    uint comp as owner.CreateComp( typeid )
 384    if &comp
 385    {
 386       comp.p_designing = 1
 387       uint ar as new( arr )->arr
 388       /*ar.itype = str
 389       ar.isize = sizeof( str )*/
 390       uint cd as cm.findcomp(comp.pTypeId )
 391       if &cd 
 392       {         
 393          //print( " \(comp.typename) cd.events \( *cd.events ) \n" )
 394          ar.expand( *cd.events )
 395       }
 396       comp.des1 = &ar   
 397    }
 398    //print( "newcomp end \n" )
 399    return comp
 400 }
 401 
 402 /*func delcompdes(vComp comp)
 403 {
 404    if comp.p_designing
 405    {     
 406       destroy( comp.des1 )       
 407       comp.delcomp()
 408    }     
 409 }*/
 410 
 411 method myform.ctrlselect( eventn ev )
 412 { 
 413    arr ar of propl
 414    //print( "SELECT\n" )
 415    wined->vVEEdit.winn->vCtrl.getproplist( ar )
 416    plist->vPropList.setar( ar )
 417    this.geteventlist( wined->vVEEdit.winn->vCtrl, ar )
 418    //wined->vVEEdit.winn->vCtrl.geteventlist( ar )
 419    this.evl->vPropList.setar( ar )
 420    this.edcur.Text = ( "     " + wined->vVEEdit.winn->vCtrl.TypeName + "     " + wined->vVEEdit.winn->vCtrl.Name ).ustr()    
 421 }
 422 
 423 method myform.ctrldelete( eventn ev )
 424 {
 425    this.setheaderf()
 426 }
 427 /*
 428 method myform.namekey()
 429 {
 430    uint c as wined->vVEEdit.winn->vCtrl      
 431    c.name = ed_name->vEdit.txt
 432 }
 433 method myform.capkey()
 434 {
 435    uint c as wined->vVEEdit.winn->vCtrl 
 436    //ed_name->vEdit.txt = c.name
 437    str cap = ed_cap->vEdit.txt
 438    switch c.typeid 
 439    {    
 440       case vPanel : c->vPanel.caption = cap
 441       case vBtn : c->vBtn.caption = cap
 442       case vEdit : c->vEdit.txt = cap
 443       default : cap=""
 444    } 
 445    
 446 }
 447 */
 448 
 449 
 450 method myform.propset( compDescr cd, vCtrl c, ustr name, value )
 451 { 
 452 // uint cd as cm.findcomp(c.typeid )
 453    if &cd 
 454    {
 455       //print( "name =\(name)\n")
 456       //print( "value = \(value)\n" ) 
 457       uint p as cd.findprop(name.str())
 458       if p.typeid == uint || p.typeid == int
 459       {
 460          uint z = value.str().uint()    
 461          if p.vals
 462          {
 463             if p.findnameval( value.str(), &z) : p.addrset->func( &c, z)               
 464          }  
 465          else : p.addrset->func( &c, z)         
 466       }
 467       elif p.typeid == str
 468       {
 469          p.addrset->func( &c, value )
 470       }
 471    }
 472 }
 473 
 474 
 475 method myform.propset( eventprop ep )
 476 {
 477    uint c as wined->vVEEdit.winn->vCtrl
 478    uint cd as cm.findcomp(c.pTypeId )
 479    if &cd 
 480    {
 481       this.propset( cd, c, ep.name, ep.value )
 482       /*
 483       uint p as cd.findprop(ep.name)
 484       if p.typeid == uint || p.typeid == int
 485       {
 486          uint z =str2int( ep.value )   
 487          if p.vals
 488          {
 489             if p.findnameval( ep.value, &z) : p.addrset->func( &c, z)
 490                
 491          }  
 492          else : p.addrset->func( &c, z)         
 493       }
 494       elif p.typeid == str
 495       {
 496          p.addrset->func( &c, ep.value )
 497       }*/   
 498       this.setheaderf()
 499       wined->vVEEdit.green()
 500       this.ctrlselect(ep)
 501    }   
 502 }
 503 
 504 
 505 method myform.eventset( compDescr cd, vCtrl c, ustr name, value, uint flgset )
 506 { 
 507 // uint cd as cm.findcomp(c.typeid )
 508    if &cd && ( checkname( value.str() ) || !*value )
 509    {
 510       uint p = cd.findevent(name.str())
 511       uint i, finded
 512       if p != -1
 513       {
 514          //print( "eventset \(flgset) \(value)\n" )
 515        /*  
 516          uint evar as c.des1->arr of str  
 517          if evar[p]!= value*/
 518          uint id = c.des1->arr[p]
 519          uint idesc = this.finddesc( id )          
 520          uint idescnew
 521          if idesc == -1 
 522          {
 523             idescnew = this.finddesc( value.str(), cd.events[p].evtype )
 524             if idescnew == -1
 525             {               
 526                uint cur = *this.evlist
 527                this.evlist.expand( 1 )
 528                this.evlist[cur].idmethod = ++this.curidmethod
 529                this.evlist[cur].name = value
 530                this.evlist[cur].evtype = cd.events[p].evtype
 531                this.evlist[cur].events++
 532                c.des1->arr[p] = this.curidmethod
 533                //print( "1 ADD \(cur) \(this.curidmethod)\n" )
 534                if flgset : this.setmethodf( value.str(), value.str(), cd.events[p].evtype )
 535             }
 536             else
 537             {
 538                this.evlist[idescnew].events++
 539                c.des1->arr[p] = this.evlist[idescnew].idmethod
 540                //print( "2 FIND\n" )
 541             }
 542          }
 543          else
 544          {
 545             uint desc as this.evlist[idesc]
 546             if !*value
 547             {
 548                if !--desc.events
 549                {
 550                   this.evlist.del( idesc )                  
 551                }
 552                c.des1->arr[p] = 0
 553                //print( "3 DEL\n" )               
 554             }
 555             elif desc.name != value
 556             {               
 557                idescnew = this.finddesc( value.str(), cd.events[p].evtype )
 558                if idescnew == -1
 559                {                  
 560                   if flgset :this.setmethodf( desc.name, value.str(), cd.events[p].evtype )
 561                   desc.name = value
 562                  // print( "4 CHANGE\n" )                  
 563                }
 564                else
 565                {
 566                  // print( "5 REMOVE\n" )
 567                   if !--desc.events
 568                   {
 569                      this.evlist.del( idesc )                  
 570                   }                  
 571                   this.evlist[idescnew].events++
 572                   c.des1->arr[p] = this.evlist[idescnew].idmethod
 573                }
 574             }
 575          }
 576          /*|| desc[i].name != value
 577          {
 578             //if *evar[p]
 579             if &desc
 580             {
 581                descnew as this.finddesc( value, cd.events[p].evtype )
 582                if &descnew
 583                {
 584                   if !--desc.events
 585                   {
 586                      this.evlist.del(i)
 587                   }
 588                }
 589                /*fornum i, *this.evlist
 590                {
 591                   if this.evlist[i].name == evar[p] &&
 592                      this.evlist[i].evtype == cd.events[p].evtype
 593                   {  //Подключен уже существующий обработчик
 594                      
 595                      if *value
 596                      {
 597                         this.evlist[i].name = value
 598                      }
 599                      else
 600                      {
 601                         if !--this.evlist[i].events
 602                         {
 603                            this.evlist.del(i)
 604                         }
 605                      } 
 606                      finded = 1
 607                      break
 608                   }
 609                } 
 610             }
 611             else //Не был определен обработчик
 612             {                          
 613                fornum i, *this.evlist
 614                {
 615                   if this.evlist[i].name == value &&
 616                      this.evlist[i].evtype == cd.events[p].evtype
 617                   {  //Подключен уже существующий обработчик
 618                      this.evlist[i].events++
 619                      finded = 1
 620                      break
 621                   }
 622                }
 623                if !finded 
 624                {
 625                   uint cur = *this.evlist
 626                   this.evlist.expand( 1 )
 627                   this.evlist[cur].name = value
 628                   this.evlist[cur].evtype = cd.events[p].evtype
 629                   this.evlist[cur].events++
 630                }
 631             }
 632             evar[p] = value
 633          }*/
 634       }
 635    }
 636 }
 637 
 638 method myform.eventset( eventprop ep )
 639 {
 640    uint c as wined->vVEEdit.winn->vCtrl
 641    uint cd as cm.findcomp(c.TypeId )
 642    if &cd 
 643    {  
 644       this.eventset( cd, c, ep.name, ep.value, 1 )
 645       /*uint p = cd.findevent(ep.name)
 646       if p != -1
 647       {
 648          uint evar as c.des1->arr of str               
 649          evar[p] = ep.value
 650       }      */
 651       this.ctrlselect(ep)
 652    }   
 653 }
 654 
 655 method uint myform.eventdblclick( eventn evn )
 656 {
 657    //print( "dblclick\n" )
 658    uint c as wined->vVEEdit.winn->vCtrl
 659    uint cd as cm.findcomp(c.TypeId )
 660    uint ar as c.des1->arr of uint
 661    uint icur = this.evl->vPropList.ncur
 662    str evname
 663    if !ar[icur]
 664    {
 665       eventprop ep
 666       ep.name = cd.events[icur].name
 667       if *cd.events[icur].name > 2
 668       {
 669          evname.substr( cd.events[icur].name, 2, *cd.events[icur].name - 2 )
 670       }
 671       else : evname = cd.events[icur].name
 672       ep.value = c.Name + "_" + evname      
 673       this.eventset( ep )
 674    }
 675    return 0
 676 }
 677 
 678 method uint myform.getlist( eventn ev )
 679 {
 680    uint c as wined->vVEEdit.winn->vCtrl
 681    uint cd as cm.findcomp(c.TypeId )
 682    if &cd 
 683    {      
 684       uint p as cd.findprop( this.prl->vPropList.ar[ this.prl->vPropList.ncur ].name.str() )
 685       if p.typeid == uint || p.typeid == int
 686       {            
 687          if p.vals
 688          {
 689 //xxx            this.prl->vPropList.cb.loadfromarr( p.vals->arr of str )           
 690          }        
 691       }
 692    }   
 693    return 0
 694 }
 695 
 696 
 697 text formg ( str listge, fname, listctrl, listuser)
 698 //GENTEE SECTION START
 699 include {   
 700    \(listge)
 701 }
 702 
 703 type \(fname) <inherit = vForm>
 704 {
 705 \(listctrl)  
 706 //USER SECTION START
 707    \(listuser)  
 708 //USER SECTION END   
 709 }
 710 //GENTEE SECTION END
 711 \!
 712 
 713 method str str.quoted<result>
 714 {
 715    uint i
 716    result.appendch( '"' )
 717    fornum i=0, *this
 718    {
 719       if this[i] == '\' || this[i] == '"'
 720       {
 721          result.appendch( '\' )
 722       }
 723       result.appendch( this[i] )     
 724    }
 725    result.appendch( '"' )
 726 }
 727 /*
 728 method uint vForm.nextctrl( uint curctrl, uint plevel )
 729 {
 730    uint owner
 731    uint ctrl as curctrl->vCtrl
 732    uint cidx 
 733     
 734    if !&ctrl
 735    {
 736       ctrl as this
 737       plevel->uint++
 738    }   
 739    elif *ctrl.ctrls
 740    {
 741       ctrl as ctrl.ctrls[0]->vCtrl
 742       plevel->uint++
 743    }
 744    else
 745    {         
 746       //print( "\(&owner)\n" )//.name )     
 747       while &ctrl != &this
 748       {         
 749          owner as ctrl.p_owner->vCtrl  
 750          cidx = ctrl.cidx + 1      
 751          if cidx < *owner.ctrls
 752          {
 753             ctrl as owner.ctrls[cidx]
 754             goto end
 755          } 
 756          ctrl as owner
 757          plevel->uint--
 758          //owner as ctrl.p_owner->vCtrl     
 759       }  
 760       ctrl as 0    
 761    }
 762 label end
 763    return &ctrl
 764 }
 765 */
 766 method str vCtrl.listproperty <result>( str ownername, myform mf ) 
 767 {  
 768    //uint x as inspm->vCompman
 769          
 770    uint i      
 771    if *ownername
 772    {
 773       result@"ctrl as this."@this.Name@"\n" 
 774       result@"ctrl.owner = "@ownername@"\n"
 775    }
 776    else : result@"ctrl as this\n" 
 777 
 778    uint c as cm.findcomp( this.TypeId )
 779    if &c 
 780    {
 781       fornum i=0, *c.props
 782       {    
 783          if c.props[i].getval(this) != c.props[i].defval
 784          {       
 785             if c.props[i].addrget
 786             {
 787                result@"ctrl."@c.props[i].name@"="
 788                //print( c.props[i].name+"\n" )             
 789                if c.props[i].typeid == str 
 790                {
 791                   result@(c.props[i].addrget->func( this,"" ))->str.quoted()     
 792                }
 793                elif c.props[i].typeid == uint || c.props[i].typeid == int
 794                {
 795                   str r
 796                   r.out4( "0x%X", (c.props[i].addrget->func( this ))) 
 797                   //print( r+"\n" )
 798                   result@r     
 799                }
 800                result@"\l"
 801             }
 802          }
 803       }
 804       uint arev as this.des1->arr of uint
 805       uint desc
 806       fornum i=0, *c.events
 807       {    
 808          if arev[i]
 809          {  
 810             desc as mf.evlist[mf.finddesc( arev[i] )] 
 811             result@"ctrl."@c.events[i].name@".set(this,\""@desc.name@"\")\l"
 812          }
 813       }
 814    }   
 815    fornum i=0, *this.ctrls
 816    {            
 817       result@this.ctrls[i]->vCtrl.listproperty(?(*ownername,"this."@this.Name, "this"), mf)      
 818    }
 819 }
 820 
 821 method str myform.listevents <result> ( str namef )
 822 {  
 823    uint i
 824    fornum i, *this.evlist
 825    {
 826    result@
 827 "method uint "@namef@"."@this.evlist[i].name@
 828 "( "@this.evlist[i].evtype@" evn )
 829 {
 830 
 831    return 0
 832 }
 833 
 834 "  
 835    } 
 836 }
 837 /*
 838 method str myform.getmethevents<result>()
 839 {  
 840    uint c as cm.findcomp( this.typeid )
 841    if &c
 842    uint arev as this.des1->arr of str
 843    fornum i=0, *c.events
 844    {    
 845       if *arev[i]
 846       {   
 847          result@"ctrl."@c.events[i].name@".set(this,\""@arev[i]@"\")\l"
 848       }
 849    }
 850    result = 
 851 }
 852 */
 853 method myform.build(eventn ev)
 854 {           
 855 
 856    str listge = "\"complib.ge\""/*"\"app.g\"
 857 \"btn.g\"
 858 \"panel.g\"
 859 \"edit.g\"*/
 860    
 861    str listctrl
 862    str listuser
 863    str namef=edform->vCtrl.Name
 864 /*   
 865    (""@formg( listge, "v"@namef, edform->vCtrl.listctrl(), listuser )@this.listevents("v"@namef)).write( "test_a.g" )
 866 */   
 867    ("method v\(namef).compinit()
 868 {
 869 uint ctrl
 870 this.p_typeid = v\(namef)
 871 "@edform->vCtrl.listproperty( "", this )@"\n}\n").write(this.srcfile+".gi")
 872     
 873 "include {
 874    \"\(this.srcfile).gf\"
 875    \"\(this.srcfile).gi\"}
 876 global {
 877    v\(namef) \(namef)
 878 }
 879 func main<main>
 880 {  
 881       
 882    \(namef).win()
 883    \(namef).compinit()   
 884    app.run( \(namef) )
 885 }".write( this.srcfile+"_main.gw")
 886    //xxxshell( this.srcfile+"_main.gw")
 887    
 888 }
 889 
 890 method myform.save(eventn ev)
 891 {
 892    uint ctrl 
 893    uint level, oldlevel
 894    uint i
 895    arr  ar of propl   
 896    str  frmtxt
 897    str  slevel
 898    arr  st[100] of uint
 899    
 900    while ctrl = edform->vForm.nextctrl( ctrl, &level, 0 ) 
 901    {
 902       for oldlevel, oldlevel >= level, oldlevel--
 903       {
 904          slevel = "  "
 905          slevel.repeat( oldlevel-1 )
 906          frmtxt@slevel@" </children>\n"@slevel@"</\(st[oldlevel]->vCtrl.Name)>\n"
 907       }  
 908       slevel = "  "
 909       slevel.repeat( level-1 )    
 910       ctrl as vCtrl      
 911       oldlevel = level
 912       st[level] = &ctrl
 913       //print( "\(&ctrl)\n" )//.name )
 914       ctrl.getproplist(ar)
 915       frmtxt@slevel@"<\(ctrl.Name) typename=\"\(ctrl.TypeName)\">\n"@slevel@" <properties>\n"
 916       fornum i = 0, *ar
 917       {         
 918          if ar[i].name != "name" && !(ar[i].ptype & $PTYPE_DEFVAL)
 919          {
 920             frmtxt@slevel@"  <\(ar[i].name)>\( ar[i].value)</\(ar[i].name)>\n"
 921          }         
 922       }
 923       frmtxt@slevel@" </properties>\n"@slevel@" <events>\n"
 924       this.geteventlist(ctrl,ar)
 925       fornum i = 0, *ar
 926       {         
 927          if *ar[i].value 
 928          {
 929             frmtxt@slevel@"  <\(ar[i].name)>\( ar[i].value)</\(ar[i].name)>\n"
 930          }         
 931       }
 932       frmtxt@slevel@" </events>\n"@slevel@" <children>\n"             
 933    }   
 934    for oldlevel, oldlevel >= level, oldlevel--
 935    {
 936       slevel = "  "
 937       slevel.repeat( oldlevel-1 )
 938       frmtxt@slevel@" </children>\n"@slevel@"</\(st[oldlevel]->vCtrl.Name)>\n"
 939    }
 940    frmtxt.write( this.srcfile+".frm" )  
 941 }
 942 
 943 method vCtrl myform.createobj(vCtrl owner, gtitem gi) 
 944 {
 945 /*xxx   gtitems gtis
 946    gtitems gtchis
 947    uint    ctrl
 948    str     typename
 949    uint    typeid
 950    str     val   
 951    uint    cd
 952    
 953    gi.getattrib( "typename", typename )
 954    //print( " \(gi.name()) \(typename)\n" )
 955    if *typename && ( typeid = getid( typename ) ) 
 956    {
 957       //print( typename )      
 958       ctrl = &newcompdes( typeid, owner )
 959       cd as cm.findcomp(typeid )
 960       ctrl->vCtrl.name = gi.name()      
 961       foreach gmi, gi.items(gtis)
 962       {
 963          if gmi.name() == "properties"
 964          {
 965             foreach gch, gmi.items(gtchis)
 966             {
 967                val.clear()               
 968                gch.get( val )               
 969                this.propset( cd, ctrl->vCtrl, gch.name(), val )           
 970             }
 971          }
 972          elif gmi.name() == "events"
 973          {
 974             foreach gch, gmi.items(gtchis)
 975             {
 976                val.clear()               
 977                gch.get( val )               
 978                this.eventset( cd, ctrl->vCtrl, gch.name(), val, 0 )           
 979             }
 980          }
 981          elif gmi.name() == "children"
 982          {
 983             foreach gch, gmi.items(gtchis)
 984             {
 985                this.createobj( ctrl->vCtrl, gch )
 986             }
 987          }
 988       }
 989    }   
 990    return ctrl->vCtrl*/ return 0->vCtrl  
 991 }
 992 
 993 /*
 994 method myform.new()
 995 {   
 996    if edform 
 997    {
 998       edform->vForm.delcomp()
 999    }
1000    this.evlist.clear()
1001    uint xwin as newcompdes( vForm, this.panright )->vCtrl
1002    edform = &xwin   
1003    xwin.name = this.getnewname( xwin->vForm.typename )
1004    xwin.p_designing = 1
1005    xwin.x =0
1006    xwin.y = 0
1007    xwin.width = 500
1008    xwin.height = 500
1009    //xwin.loc.x = 0
1010    //xwin.loc.y = 0
1011    SetWindowPos( edform->vForm.hwnd, 1, 0, 0, 0, 0, $SWP_NOMOVE | $SWP_NOSIZE | $SWP_NOACTIVATE )     
1012    wined->vVEEdit.select( edform->vCtrl )
1013    this.setnew()
1014 }
1015 
1016 method myform.new(eventn evn)
1017 {
1018    this.new()   
1019 }
1020 
1021 method myform.load()
1022 {
1023    gt fgt
1024    uint gti   
1025    gtitems gts    
1026    if !fileexist( this.srcfile+".frm" ) || !fgt.read( this.srcfile+".frm" )
1027    {
1028       this.new()
1029       return
1030    }    
1031    gti as fgt.root()
1032    if edform 
1033    {
1034       edform->vForm.delcomp()
1035    }
1036    this.evlist.clear()
1037    
1038    edform = &this.createobj( this.panright, gti.items(gts).first()->gtitem)
1039    
1040    SetWindowPos( edform->vForm.hwnd, 1, 0, 0, 0, 0, $SWP_NOSIZE | $SWP_NOACTIVATE )     
1041    wined->vVEEdit.select( edform->vCtrl )
1042 }
1043 */
1044 method myform.about(eventn evn)
1045 {
1046  //  shell( "readme.txt" )
1047 }
1048 
1049 method myform.bt_arrowc(eventn ev)
1050 {
1051    if this.bt_arrow.Checked : wined->vVEEdit.flgadd = 0
1052 }
1053 method myform.bt_btnc(eventn ev)
1054 {  
1055    if this.bt_btn.Checked : wined->vVEEdit.flgadd = 1
1056 }
1057 method myform.bt_panelc(eventn ev)
1058 {
1059    if this.bt_panel.Checked : wined->vVEEdit.flgadd = 2
1060 }
1061 method myform.bt_editc(eventn ev)
1062 {
1063    if this.bt_edit.Checked : wined->vVEEdit.flgadd = 3
1064 }
1065 
1066 
1067 /*
1068 include {
1069    "myform_ifrm.g"
1070 }*/