Navigation:  The Buzz > Forms and Controls > Tabs >

Simple Tab Control

Previous pageReturn to chapter overviewNext page

Dec 26, 2007  Button

This is a real newbie question! Using this table:

Key alpha 10

Data alpha 1000

 

How do you use a tab such that the tab is labeled with Key and the body of

the tab shows Data? Tabs could surely not be more simple than that! There

would be a tab for each record in the file and the whole thing is dynamic,

depending on the table.

 

Here's ONE way:

 

Make the task's Main table to be the table that contains the Key and

Data columns; select the index selected that is the unique index on

the Key column.

 

Select an Alpha virtual variable A - we'll call it "SelectedKey" -

having a picture of '10', and a second virtual variable B - we'll

call this one "KeyList" - having a picture at least as large as

ELEVEN times the number of Key values in the table.

 

Then Select the real columns Key and Data and, on the Key column,

place upper and lower Range expressions of SelectedKey.

 

In the Task Prefix, call a batch task that reads all of the Key

values in the table, and concatenates them together into KeyList. In

this batch task's Record Suffix, place the following operations:

 

Block If IsFirstRecordCycle(0)

Update KeyList = Key

Block Else

Update KeyList = Trim(KeyList) & ',' & Key

Block End

 

Back in the online task, open the Form Editor and place a tab control

on the form. For this control's "Data" property, assign the virtual

variable SelectedKey and, for its "Items list" property, assign the

virtual variable KeyList.

 

Place an edit control OVER the tab control, but do not link this

control to the tab control. In this way, it will appear on every tab

but really it will just be floating over the tab control. Assign the

edit control's Data property to the real column Data.

 

Steve Blank

 

>> Place an edit control OVER the tab control, but do not link this control

to the tab control. <<

 

Big problem with that technique in v10, Steve. If you use the new default

Windows tab control, the edit control over the tab control won't display.

This is regardless of z-order.

 

Andy

 

Interesting use of a Tab control.

 

My approach would be:

 

1) One 'TabRange' Alpha Virtual: Long enough To hold a ',' separated

string of all the Key values of the table.

 

2) I would have a batch task to feed the above string from some

parent task to have the result ready when coming to the online task

with the Tab to which the above virtual would be assign as an

expression for the range.

 

3) In the Online task, I would try to have a Link based on the

current value of the Tab, showing (and editing, why not?) the Data

column that would be placed on the tab not linked to any particular

Tab value (layer 0 or something like this).

 

I did not try it, but this is how I would start it.

 

Omar

 


Page url: http://www.magic-iug.com/MIUGWeb3/index.html?hm_simple_tab_control.htm