目次
前
次
ラベルオブジェクト生成
画面構成でラベルオブジェクトを決めたので
コマンドでオブジェクトを生成します。
逐次オブジェクトを生成するのは面倒なので
スクリプトを使い、プログラムで生成します。
1行にオブジェクトの元になる文字列を並べて
AWKでオブジェクト生成のコマンドを生成して
みます。
オブジェクト一覧は、テキストファイルで次のように記述。
P0
P1
P2
P3
P4
P5
AWKのスクリプトは、以下。
{
printf("label .lbl%s -font {{MS ゴシック} 14 italic} -width 10 -text \"%s\"\n",$1,$1)
}
コマンドラインで、次のようにタイプし、I/Oリダイレクトで
ファイルへ出力しておきます。
jgawk -f tt.awk tt.txt > ttx.txt{enter}
生成されるテキストファイルは、以下。
label .lblP0 -font {{MS ゴシック} 14 italic} -width 10 -text "P0"
label .lblP1 -font {{MS ゴシック} 14 italic} -width 10 -text "P1"
label .lblP2 -font {{MS ゴシック} 14 italic} -width 10 -text "P2"
label .lblP3 -font {{MS ゴシック} 14 italic} -width 10 -text "P3"
label .lblP4 -font {{MS ゴシック} 14 italic} -width 10 -text "P4"
label .lblP5 -font {{MS ゴシック} 14 italic} -width 10 -text "P5"
同じ要領で、全ラベルを生成し、編集します。
作業結果は、以下。
label .lblTTemp -font {{MS ゴシック} 16} -width 16 -text "Temperature"
label .lblTTime -font {{MS ゴシック} 16} -width 16 -text "Time"
label .lblTTempUnit -font {{MS ゴシック} 16} -width 10 -text "celcius(C)"
label .lblTTimeUnit -font {{MS ゴシック} 16} -width 10 -text "(mm:ss)"
label .lblP0 -font {{MS ゴシック} 14 italic} -width 10 -text "P0"
label .lblP1 -font {{MS ゴシック} 14 italic} -width 10 -text "P1"
label .lblP2 -font {{MS ゴシック} 14 italic} -width 10 -text "P2"
label .lblP3 -font {{MS ゴシック} 14 italic} -width 10 -text "P3"
label .lblP4 -font {{MS ゴシック} 14 italic} -width 10 -text "P4"
label .lblP5 -font {{MS ゴシック} 14 italic} -width 10 -text "P5"
label .lblFileName -font {{MS ゴシック} 16} -width 10 -text "FileName"
label .lblHandling -font {{MS ゴシック} 14 bold} -width 10 -text "HANDLING"
label .lblPath -font {{MS ゴシック} 14 bold} -width 10 -text "PATH"
label .lblCTime -font {{MS ゴシック} 14 bold} -width 16 -text "Time"
label .lblCTemp -font {{MS ゴシック} 14 bold} -width 16 -text "Temperature"
label .lblCPathV -font {{MS ゴシック} 14 bold} -width 16 -textvariable cPathV
label .lblCTimeV -font {{MS ゴシック} 14 bold} -width 16 -textvariable cTimeV
label .lblCTempV -font {{MS ゴシック} 14 bold} -width 16 -textvariable cTempV
コマンドのオプションに「-textvariable」を使うのは
動作中に更新されるオブジェクトだけ。
画面では、以下の部分に表示する文字列に相当。
目次
前
次