Are #Control Radio and Tab controls possible?

I’d like to be able to create a #Control template for radio buttons and tabs, the optionbox and sheet #Control already have their own prompts which appear on the controls action tab and in the Procedure Extension section and they are working just fine.

I can even add only a single radio button and only a single tab in the respective parent #control template if I wanted and that sort of works fine, but the action tab for the radio button and tab displays the prompts for the respective optionbox or sheet control, but I cant for life of me get the radio or tab to work as a seperate #Control template when I include a definition for them inside the “Controls” section.

These below do not work. They throw the error “Syntax error reading Window or Report”.

#Control(MyRadioButton),'Text which appears in various IDE Template windows'),Multi,Req(MyOptionBoxControlTemplate,Before)
#Prepare
#! Some stuff happens here
#EndPrepare
#Display('This appears on the Control's Action Tab in the Window formatter')
#Display(' "Controls" on the next line can not start in Column 1')
 Controls
 Radio('Text'),Use(?ThisIsNeeded)
 End
#! Other template code carries on below, like #AT embeds, #Groups etc.


#Control(MyTab),'Text which appears in various IDE Template windows'),Multi,Req(MySheetControlTemplate,Before)
#Prepare
#! Some stuff happens here
#EndPrepare
#Display('This appears on the Control's Action Tab in the Window formatter')
#Display(' "Controls" on the next line can not start in Column 1')
 Controls
 Tab('Text'),Use(?ThisIsNeeded)
 End
 End
#! Other template code carries on below, like #AT embeds, #Groups etc.

So does anyone know if its possible to do separate #Control templates for Radio buttons and Tabs?

I not there are no shipping template examples of using a #Control template for a Sheet or Option box, these are created in the #Untility templates inside #Default which is the starting point of creating a procedure. That why I wonder if its possible.

TIA

Morning Richard,

yeah, it’s possible.

So Tab controls belong on a SHEET. Which you have to add, so think something like

  Controls
    SHEET,AT(,,430,260),USE(?SettingsSheet)
      TAB('Security'),USE(?SecurityTab)
          PROMPT('Secure Port:'),AT(10,10),TRN,USE(?set:SecurePort:Prompt)
      END
      TAB('Site'),USE(?SiteTab)
          PROMPT('Web folder:'),AT(10,10),TRN,USE(?set:WebFolder:Prompt)
      END
    END

Radio buttons belong inside an OPTION. As in

  Controls
      OPTION('Log:'),AT(-205,153,141,22),USE(web:EnableLogging),BOXED
        RADIO('No'),AT(7,9),USE(?Option1:Radio1),VALUE('0'),TRN
        RADIO('Screen'),AT(28,0),USE(?Option1:Radio2),VALUE('1'),TRN
      END

With Tabs, there’s a catch. (Radios and Options are just fine.)

So, the problem with TAB’s is in how the template language works. Basically in a Control template the AT attribute refers to the position relative to the previous control. Failure to add an AT means the user has to click the mouse again to set the new relative point.

But AT on a tab is illegal. So AT on TABs inside a control template is illegal. Meaning the user has to click once for each tab. It’s a pain, but as long as you know it’s coming it’s ok.

I recommend;
a) one click to position the control template (usually the top-left corner of the sheet control.)
b) then move the mouse down a little bit - say about a half a centimetre, and just a smijion to the left so it’s no longer hovering over the dropped Sheet control. Then slowly click once per tab. Don’t rush this, and whatever happens don’t click too often.
c) IMMEDIATELY save and close the Window designer. Doing ANYTHING else will almost certainly crash the IDE.
d) return to the Window Designer and carry on as normal.

cheers
Bruce

If I create a #Control template which has the sheet and a single tab in the Controls section, the sheet will appear in the window formatter with the single tab.
If I create a #Control template which has the sheet and two tabs in the Controls section, the sheet will appear in the window formatter with the two single tabs for a split second and then disappears.

The same applies with the OptionBox, I can get them to appear and stay visible in the window formatter only if one Radio is declared in the Controls section. Two or more and it disappears.

This is why I was asking if its possible to do a #Control template for individual Tabs and Radio buttons.

I had also noticed the change in practice when adding the tab by having to move the mouse off the sheet in order to get the tab to appear.

I use a Option with Radio buttons just fine - The WebServer logging template has them. That’s where the code above comes from.

With multiple tabs you need to do the clicking method I mentioned because each tab has not AT statement, so the template waits for you to click again. This has been true since Clarion 7, I don’t recall doing it in Clarion 6.

Feel free to post a small example template if you are strugelling.

cheers
Bruce

I havent got any AT()'s in my templates here so I’ll see what happens when I add them. If not I’ll stick with looping through the child controls of the Sheet and Optionbox to populate a listbox #button in which contains their prompt’s.

Edit.

So what I have working is a button on the action tab of the sheet and optionbox, and when this is clicked, WhenAccepted(%grpProcessTabs) is called which works out the tabs on the sheet or the option boxes and then synchs them to a #Button,Multi,Inline I have setup here to handle the Tab and Radio button prompts which would have been on the action tab for these controls.

I can then add, change or delete the tabs or radio buttons using the standard controls which I think is an acceptable workaround. Added bonus is I dont have that problem you describe with tabs in C11. :grinning: