Sie befinden sich auf der NewGUI Sourcepage

Start
Über NewGui
Featureübersicht
Changesübersicht
Installation
Download
Demos
Anwendungen
Tutorials
Sourcecodes
-Button Beispiel
-Checkbox Beispiel
-TextEditor
-Flächen & Füllroutinen
-Eingabegadgets
-
Links
Kontakt

Unser Hostingpartner

; NEWGUI Demo
; 
; (c) 2003 Cyborg 

    {* Include sys:coder/preass/Options.p *}
    {* String: Version=": (C) CYBORG 2003"*}
    {* usefd:sys:coder/fd/newgui_lib.fd *}

    {* Include sources:newgui/generic/defines.i *}
    {* Include module:string.p *}
    {* Include module:filerequester.p *}
    {* Include module:fillbuffer.p *}

MyHook:
    {* IncVar: ocpx,ocpy,omy,omx*}
    {* Stackframe tags=a1,cpx,cpy,my,mx*}
    
    CPX=GetTagData(#NG_INDEX_X,0,Tags)
    CPY=GetTagData(#NG_INDEX_Y,0,Tags)
    MX=GetTagData(#NG_EDIT_GET_MAX_X,0,Tags)
    MY=GetTagData(#NG_EDIT_GET_MAX_Y,0,Tags)
    if ocpx#cpx or omx#mx {
        UpdateGadget(Gui,4,>XsliderTags:NG_VALUE,*CPX|
                                        NG_SLIDER_MAX,*MX|
                                        TAG_done,null)
        omx==mx
        ocpx==cpx                                        
    }        
    if ocpy#cpy or omy#my {
        UpdateGadget(Gui,5,>YsliderTags:NG_VALUE,*CPY|
                                        NG_SLIDER_MAX,*MY|
                                        TAG_done,null)
        omy==my
        ocpy==cpy                                        
    }        
    {* unFrameReturn *}

    {* String: TextIni=""*}

Start:

    Gui=Open_Window(150,100,600,200,"TESTWINDOW",#WFLG_DRAGBAR!WFLG_REPORTMOUSE!WFLG_Sizegadget!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET!WFLG_RMBTRAP!WFLG_SMART_REFRESH,#IDCMP_MOUSEBUTTONS!IDCMP_ACTIVEWINDOW!IDCMP_MOUSEMOVE,0)
    if gui#0
     {
       if (deep_Knob1=createDeep(Gui,"sl_knob1a.deep"))#0
        {
          if (deep_Knob2=createDeep(Gui,"sl_knob2a.deep"))#0
           {
             if (deep_Knob1v=createDeep(Gui,"sl_knob1v.deep"))#0
              {
                if (deep_Knob2v=createDeep(Gui,"sl_knob2v.deep"))#0
                 {
                   if (Deep=PlaceDeep(Gui,0,0,"sl_bg1.deep"))#0
                    {
                      UpdateGui(gui,>updatetags:NG_BACKGROUND_IMAGE,*deep|
                                                TAG_DONE,null)
                      if (Deep1=CreateDeep(Gui,"sl_bg2.deep"))#0
                       {
                         deepBG1=CropDeep(deep,100,30,400,125,"Kopie von a")
                         deepBG2=CropDeep(deep1,100,30,400,125,"Kopie von b")
                         deepBG3=CropDeep(deep1,100,10,400,15,"Kopie von b")
                         deepBG4=CropDeep(deep,430,160,70,15,"Kopie von a")
                         deepBG5=CropDeep(deep1,430,160,70,15,"Kopie von b")
                         
                         deepBGL=CropDeep(deep,100,160,60,15,"Kopie von a")
                         deepBGL1=CropDeep(deep1,100,160,60,15,"Kopie von a")
                         deepBGS=CropDeep(deep,170,160,60,15,"Kopie von a")
                         deepBGS1=CropDeep(deep1,170,160,60,15,"Kopie von a")

                         CreateGadgetGeneric(Gui,100,010,400,015,"TextEditor",deepBG3,0,0,"generic/bevelbox.library",0)
                         CreateGadgetGeneric(Gui,430,160,070,015,"Quit",deepbg4,deepbg4,deepbg5,"generic/button.library",0)
                         result=CreateGadgetGeneric(Gui,100,030,400,125,"Editgadget",deepbg1,0,deepbg2,
                                                    "generic/edit.library",>editTags:NG_TEXT_POS,NG_LEFT|
                                                                                     NG_VALUE,TEXTini|
                                                                                     NG_HOOK,MyHook|
                                                                                     tag_done,null)
                        
                         maxX==1
                         maxY==3
                         XSlider=CreateGadgetGeneric(Gui,100,180,400,015,"Slider X",0,0,0,
                                             "generic/slider.library",>SliderGadget5:NG_TEXT_POS,NG_LEFT|
                                                                                     NG_VALUE,0|
                                                                                     NG_SLIDER_MIN,0|
                                                                                     NG_SLIDER_MAX,*maxX|
                                                                                     NG_SLIDER_STEP,1|
                                                                                     NG_INVERSE,1|
                                                                                     NG_SLIDER_KNOB_U,*deep_Knob2|
                                                                                     NG_SLIDER_KNOB_D,*deep_Knob1|
                                                                                     NG_SLIDER_KNOB_MODE,NG_SLIDER_IMAGE|
                                                                                     NG_NOTICE,*result|
                                                                                     NG_NOTICE_VALUE,NG_INDEX_X|
                                                                                     tag_done,null)
                        
                         YSlider=CreateGadgetGeneric(Gui,507,030,015,125,"Slider Y",0,0,0,
                                             "generic/slider.library",>SliderGadget6:NG_TEXT_POS,NG_RIGHT|
                                                                                     NG_VALUE,0|
                                                                                     NG_SLIDER_MIN,0|
                                                                                     NG_SLIDER_MAX,*MaxY|
                                                                                     NG_SLIDER_STEP,1|
                                                                                     NG_INVERSE,1|
                                                                                     NG_SLIDER_KNOB_U,*deep_Knob2v|
                                                                                     NG_SLIDER_KNOB_D,*deep_Knob1v|
                                                                                     NG_SLIDER_KNOB_MODE,NG_SLIDER_IMAGE|
                                                                                     NG_NOTICE,*result|
                                                                                     NG_NOTICE_VALUE,NG_INDEX_Y|
                                                                                     NG_SLIDER_DIR,NG_VERT|
                                                                                     NG_BORDER,1|
                                                                                     tag_done,null)
                        
                         CreateGadgetGeneric(Gui,100,160,060,015,"Load",deepbgl,deepbgl,deepbgl1,"generic/button.library",0)
                         CreateGadgetGeneric(Gui,170,160,060,015,"Save",deepbgs,deepbgs,deepbgs1,"generic/button.library",0)
                         gadget==0
                          class==0
                         configname=malloc(1000,#MEMF_FAST!MEMF_CLEAR)
                         
                         while class##IDCMP_Closewindow 
                          { 
                            (Gadget,Class)=WaitGuiEvent(Gui,0)
                        
                            if Class=#IDCMP_MOUSEBUTTONS
                             {
                               if gadget=2 and getGadgetStatus(Gui,Gadget)=0
                                {
                                  class==#IDCMP_Closewindow
                                }
                               if gadget=6 and getGadgetStatus(Gui,Gadget)=0
                                {
                                  ASLTitletext=="Load Text:"
                                  Bis=PathPart(Configname)
                                  Ab=FilePart(Configname)
                                  fillbuffer(&FR_dirname,0,256)
                                  fillbuffer(&FR_name,0,256)
                                  CopyMem(configname,&FR_DIRNAME,Bis-Configname)
                                  strcopy(Ab,&FR_Name)
                                  FileReq(0)
                                  If Result#0 
                                   {
                                     Copymem(#FR_Name_bak,Configname,999)
                                     if (fh=open(configname,#mode_old))#0 
                                      {
                                        Len=Seek(fh,0,#offset_end)
                                        Len=Seek(fh,0,#offset_begin)
                                        if (mem=Allocmem(len+1,#MEMF_FAST!MEMF_Clear))#0
                                         {
                                           Read(fh,mem,len)
                                           UpdateGadgetValue(Gui,3,mem)
                                           UpdateGadget(Gui,3,>Get1Tags:NG_EDIT_GET_MAX_X,omx|
                                                                        NG_EDIT_GET_MAX_Y,omY|
                                                                        Tag_done,null)
                                           UpdateGadget(Gui,4,>X1sliderTags:NG_VALUE,0|
                                                                            NG_SLIDER_MAX,*OMX|
                                                                            TAG_done,null)
                                           UpdateGadget(Gui,5,>Y1sliderTags:NG_VALUE,0|
                                                                            NG_SLIDER_MAX,*OMY|
                                                                            TAG_done,null)
                         
                                           Freemem(mem,len+1)
                                         }
                                        Close(Fh)
                                      }
                                   }
                                }
                               if gadget=7 and getGadgetStatus(Gui,Gadget)=0
                                {
                                  ASLTitletext=="Save Text:"
                                  Bis=PathPart(Configname)
                                  Ab=FilePart(Configname)
                                  fillbuffer(&FR_dirname,0,256)
                                  fillbuffer(&FR_name,0,256)
                                  CopyMem(configname,&FR_DIRNAME,Bis-Configname)
                                  strcopy(Ab,&FR_Name)
                                  FileReq(0)
                                  If Result#0 
                                   {
                                     Copymem(#FR_Name_bak,Configname,999)
                                     if (fh=open(configname,#mode_new))#0 
                                      {
                                        mem=getGadgetValue(Gui,3)
                                        len=Strlen(mem)
                                        Write(fh,mem,len)
                                        Close(Fh)
                                      }
                                   }
                                }
                             }
                          }

                         FreeDeep(DeepBGL)
                         FreeDeep(DeepBGL1)
                         FreeDeep(DeepBGS)
                         FreeDeep(DeepBGS1)
                         freeDeep(deepBG1)
                         freeDeep(deepBG2)
                         freeDeep(deepBG3)
                         freeDeep(deepBG4)
                         freeDeep(deepBG5)
                         freeDeep(deep1)
                       }
                      freeDeep(deep)
                    }
                   FreeDeep(deep_Knob2v)
                 }
                FreeDeep(deep_Knob1v)
              }
             FreeDeep(deep_Knob2)
           }
          FreeDeep(deep_Knob1)
        }
       Close_Window(Gui)
     }
    {* Return *}