` Printed Icetips Article

Icetips Article



ABC: Small demo template
1998-08-09 -- Jim Dennison
 
Newsgroups: comp.lang.clarion

> Maybe someone can help? I've been hitting my brain very hard for so long...
> Well, I'm writting a template with a #BUTTON calling another window.
> On this window I have a list box from where I can call a third window to
> insert  window controls. So far so good.
>
> Now how do I generate embeds for each of these controls???
> When I compile, the code is generated only once, on only one control. It
> works but
> I also want it to generate for the other controls.
> I tried PRESERVE on the #AT, still no go. Any ideas? Here is the code:
>
> #BUTTON('My Controls...'),MULTI(%FieldList,%MyControl)
>     #PROMPT('My Control:',CONTROL),%MyControl
> #ENDBUTTON
>
> #AT(%DataSection)
>   #FOR(%FieldList)
> %SomeVariable        string(10)
>   #ENDFOR
> #ENDAT
>
> #AT(%ControlEventHandling,%MyControl,'Accepted')
>     ... some generated code... (this is the part which is generated only once)
> #ENDAT

I'm not exactly sure what you are trying to accomplish, but for what it's worth
I've been racking my brain for about six weeks with a large template chain.

It would be nice if someone wrote a book on template design to help us trial
and error programmers. But maybe that's what seperates the pros from the
amateurs.

When you do finaly  break the down the wall you've been hitting your head
against and get your template to work, it's really exciting!

Anyway for whatever it's worth heres's a group of buttons for forms, browses, reports,
etc
with my embeded source code. I extracted this control template from my chain, which
contains
Window Templates, Code Templates, Extension Templates, Control Templates etc.

All of the code below works, maybe it will help:

#CONTROL (QueryBrowseButtons, 'Browse Query, Reset, & Report Buttons')
     CONTROLS
       BUTTON('&Query'),AT(,,45,14),USE(?QueryButton)
       BUTTON('&Reset'),AT(50,0,45,14),USE(?ResetButton)
       BUTTON('Query Re&port'),AT(50,0,57,14),USE(?QueryReportButton)
     END
#BOXED ('Query Template')
#DISPLAY ('      Select An Existing Query Window Procedure')
#DISPLAY ('      Or Enter A Unique Name For A New Query Window.')
#DISPLAY ('')
#PROMPT ('Query Window Procedure:', PROCEDURE), %SelectQueryWindowName, REQ
#PROMPT ('Select Report For Query:', PROCEDURE), %ReportProcedure
#ENDBOXED
#AT (%ControlEventHandling, '?QueryButton', 'Accepted')
      %SelectQueryWindowName  !QueryWindow
      If QueryString
        Brw1.SetFilter(QueryString)
      Else
       Brw1.SetFilter(QueryString)
      End
      ThisWindow.Reset(True)
      ENABLE(?ResetButton)
#ENDAT
#AT (%ControlEventHandling, '?ResetButton', 'Accepted')
      Clear(QueryString)
      DISPLAY
      If QueryString
        Brw1.SetFilter(QueryString)
      Else
       Brw1.SetFilter(QueryString)
      End
      ThisWindow.Reset(True)
      IF NOT QueryString
        DISABLE(?ResetButton)
         ELSE
           ENABLE(?ResetButton)
      END
#ENDAT
#AT (%ControlEventHandling, '?QueryReportButton', 'Accepted')
    %ReportProcedure
#ENDAT
#CONTROL (QueryFormButton, 'Button to Save Query')
     CONTROLS
       BUTTON('&Use Query String'),AT(,,75,14),USE(?UseQueryStringButton)
     END
#BOXED (' Save Query Form Button')
#DISPLAY ('There are no prompts for this Template.')
#ENDBOXED
#AT (%ControlEventHandling, '?UseQueryStringButton', 'Accepted')
    Que:Query = QueryString
      Display()
#ENDAT
#!-----------------------------------------------------------------------
#EXTENSION ('ReportQuery')
#BOXED (' Report Query Extension')
#DISPLAY ('There are no Prompts for this Template.')
#ENDBOXED
#AT (%WindowManagerMethodCodeSection, 'Open', '()'), PRIORITY(4000)
      SELF.PROCESS.SetFilter(QueryString)
#ENDAT
#!--------------------------------------------------------------------



Printed November 21, 2024, 11:54 am
This article has been viewed/printed 35396 times.
Google search has resulted in 51 hits on this article since January 25, 2004.