HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2009
0919
Hiromichioverfllowスクロールボックスの表示2未解決


Hiromichi

リンク

2009/9/19(Sat) 19:37:43|NO.27788

初めまして。
htmlのテーブル生成ツールを制作しているのですが、
webサイトでよく見る、overfllowスクロールボックスのようなものが作りたくて
似たようなサンプルを探しているのですがなかなか見つからず困っています。

参考までに以下にスクリプト載せときます。
縦セルの追加をした時に画面に収まる限界があるのでどうしようか困っています。
また、ここはこうした方が使いやすいなどアドバイスください。



// HTMLソース整形ツール - table整形 -


// 最大化ウィンドウ、ウィンドウサイズ可変
#include "user32.as"
screen 0, ginfo(20), ginfo(21)
// 自ウィンドウのスタイルを変更
// $10000 = 最大化ボタン有効
// $40000 = ウィンドウサイズ可変有効
GetWindowLong hwnd, -16
SetWindowLong hwnd, -16, stat | $10000 | $40000
// 実際に表示するサイズを指定
width 700, 550
// スクリプトから最大化ウィンドウにしたい場合
// sendmsg hwnd, $112, $F030


;初期設定
title "htmlテーブル作成支援 ver1.0"

;オブジェクトの初期入力文字
t1 = "タイトル1" ; 文字列型
t2 = "タイトル2"
t3 = "タイトル3"
t4 = "タイトル4"
t5 = "タイトル5"

a = "a"
b = "b"
c = "c"
d = "d"
e = "e"

a2 = "a2"
b2 = "b2"
c2 = "c2"
d2 = "d2"
e2 = "e2"

a3 = "a3"
b3 = "b3"
c3 = "c3"
d3 = "d3"
e3 = "e3"

a4 = "a4"
b4 = "b4"
c4 = "c4"
d4 = "d4"
e4 = "e4"

a5 = "a5"
b5 = "b5"
c5 = "c5"
d5 = "d5"
e5 = "e5"

; オブジェクトの表示位置
pos 25, 25

; 入力ボックス設置 ◇input 変数, 横幅サイズ, 高さサイズ, 最大文字数◇
pos 5 , 25 : input t1, 100, 25
pos 110, 25 : input t2, 100, 25
pos 215, 25 : input t3, 100, 25
pos 320, 25 : input t4, 100, 25
pos 425, 25 : input t5, 100, 25

pos 5 , 55 : input a, 100, 25
pos 110, 55 : input b, 100, 25
pos 215, 55 : input c, 100, 25
pos 320, 55 : input d, 100, 25
pos 425, 55 : input e, 100, 25

pos 5 , 85 : input a2, 100, 25
pos 110, 85 : input b2, 100, 25
pos 215, 85 : input c2, 100, 25
pos 320, 85 : input d2, 100, 25
pos 425, 85 : input e2, 100, 25

pos 5 ,115 : input a3, 100, 25
pos 110,115 : input b3, 100, 25
pos 215,115 : input c3, 100, 25
pos 320,115 : input d3, 100, 25
pos 425,115 : input e3, 100, 25

pos 5 ,145 : input a4, 100, 25
pos 110,145 : input b4, 100, 25
pos 215,145 : input c4, 100, 25
pos 320,145 : input d4, 100, 25
pos 425,145 : input e4, 100, 25

pos 5 ,175 : input a5, 100, 25
pos 110,175 : input b5, 100, 25
pos 215,175 : input c5, 100, 25
pos 320,175 : input d5, 100, 25
pos 425,175 : input e5, 100, 25

; 区切り線
syscolor 15
boxf
pos 5, 20
winobj "static", "", , $50000000 | $10, 525

pos 5, 205
winobj "static", "", , $50000000 | $10, 525


; 横列追加
pos 530,25 : objsize 25,175 : button goto ">", *yokoretutuika


; 実行ボタン
pos 120,210 : objsize 300,40 : button goto "実行", *check2

; 実行結果表示 ◇mesbox 変数, 横幅サイズ, 高さサイズ, スタイル(0or1or5), 最大文字数◇
result="実行ボタンを押すことでこのエリアに結果が反映されます。"
pos 5, 255 : mesbox result, 520, 220, 1, : mbID = stat
stop

*check2
gosub *check
result=""+h1+h2+h3+h4+h5+h6+h7+h8+h9+h10+h11+h12+h13+h14+h15+h16+h17+h18+h19+h20+h21+h22+h23+h24+h25+h26+h27+h28+h29+h30+h31+h32+h33+h34+h35+h36+h37+h38+h39+h40+h41+h42+h43+hfin
pos 25, 200 : objprm mbID, result
stop

*check
; htmlベース
h1 = "\<table>\n"
h2 = "\t\<tr>\n"
h3 = "\t\t<td>"+t1+"</td>\n"
h4 = "\t\t<td>"+t2+"</td>\n"
h5 = "\t\t<td>"+t3+"</td>\n"
h6 = "\t\t<td>"+t4+"</td>\n"
h7 = "\t\t<td>"+t5+"</td>\n"
h8 = "\t\</tr>\n"

h9 = "\t\<tr>\n"
h10 = "\t\t<td>"+a+"</td>\n"
h11 = "\t\t<td>"+b+"</td>\n"
h12 = "\t\t<td>"+c+"</td>\n"
h13 = "\t\t<td>"+d+"</td>\n"
h14 = "\t\t<td>"+e+"</td>\n"
h15 = "\t\</tr>\n"

h16 = "\t\<tr>\n"
h17 = "\t\t<td>"+a2+"</td>\n"
h18 = "\t\t<td>"+b2+"</td>\n"
h19 = "\t\t<td>"+c2+"</td>\n"
h20 = "\t\t<td>"+d2+"</td>\n"
h21 = "\t\t<td>"+e2+"</td>\n"
h22 = "\t\</tr>\n"

h23 = "\t\<tr>\n"
h24 = "\t\t<td>"+a3+"</td>\n"
h25 = "\t\t<td>"+b3+"</td>\n"
h26 = "\t\t<td>"+c3+"</td>\n"
h27 = "\t\t<td>"+d3+"</td>\n"
h28 = "\t\t<td>"+e3+"</td>\n"
h29 = "\t\</tr>\n"

h30 = "\t\<tr>\n"
h31 = "\t\t<td>"+a4+"</td>\n"
h32 = "\t\t<td>"+b4+"</td>\n"
h33 = "\t\t<td>"+c4+"</td>\n"
h34 = "\t\t<td>"+d4+"</td>\n"
h35 = "\t\t<td>"+e4+"</td>\n"
h36 = "\t\</tr>\n"

h37 = "\t\<tr>\n"
h38 = "\t\t<td>"+a5+"</td>\n"
h39 = "\t\t<td>"+b5+"</td>\n"
h40 = "\t\t<td>"+c5+"</td>\n"
h41 = "\t\t<td>"+d5+"</td>\n"
h42 = "\t\t<td>"+e5+"</td>\n"
h43 = "\t\</tr>\n"

hfin = "\</table>"
return

*yokoretutuika
clrobj 32, 32
t6 = "タイトル6"
f = "f"
f2 = "f2"
f3 = "f3"
f4 = "f4"
f5 = "f5"
f6 = "f6"
pos 530, 25 : input t6, 100, 25
pos 530,55 : input f, 100, 25
pos 530,85 : input f2, 100, 25
pos 530,115 : input f3, 100, 25
pos 530,145 : input f4, 100, 25
pos 530,175 : input f5, 100, 25
stop



この記事に返信する


a

リンク

2009/9/19(Sat) 19:59:03|NO.27789

とりあえず、配列変数と repeat ~ loop を使うともっと簡潔になると思ふ



シモン

リンク

2009/9/20(Sun) 13:56:56|NO.27807

私も一番最初のコードは今でも人に見せたくない。

それと、どういったものでも例え車輪の再開発でも
仕上げるのが最初の関門だと考えているので「Hiromichi」さんを支援
気紛れなので最後まで支援できるかわかりませんが…

出来るだけ最初のイメージを崩さないようにしてみました。


// HTMLソース整形ツール - table整形 - // 最大化ウィンドウ、ウィンドウサイズ可変 #include "user32.as" #packopt hide 1;//非表示ウィンドウで作成 ;screen 0, ginfo(20), ginfo(21) // 自ウィンドウのスタイルを変更 // $10000 = 最大化ボタン有効 // $40000 = ウィンドウサイズ可変有効 GetWindowLong hwnd, -16 SetWindowLong hwnd, -16, stat | $10000 | $40000 // 実際に表示するサイズを指定 wx = 530 wy = 480 screen 0,wx,wy,2,(ginfo_dispx-wx)/2,(ginfo_dispy-wy)/2 ;//画面中央にウインドドウを表示 // スクリプトから最大化ウィンドウにしたい場合 // sendmsg hwnd, $112, $F030 ;初期設定 title "htmlテーブル作成支援 ver1.0" ; オブジェクトの表示位置 pos 25, 25 ;オブジェクトの初期入力文字 ; 入力ボックス設置 ◇input 変数, 横幅サイズ, 高さサイズ, 最大文字数◇ i1=0:i2=0:gyou=5:retu=1 repeat gyou+1 ;t.cnt = "タイトル"+str(cnt) ; 文字列型 repeat retu if (i1=0){ a.int(str(i1)+str(i2)) = "タイトル"+str(i1)+str(i2) pos 5+(105*cnt) , 25+30*i1 : input a.int(str(i1)+str(i2)), 100, 25 }else{ a.int(str(i1)+str(i2)) = "a"+str(i1)+str(i2) pos 5+(105*cnt) , 25+30*i1 : input a.int(str(i1)+str(i2)), 100, 25 } i2++ aoid.int(str(i1)+str(i2))=stat loop aoidnum=int(str(i1)+str(i2)) i1++ :i2=0 loop ; 区切り線 syscolor 15 boxf repeat 2 pos 5, 20+180*cnt winobj "static", "", , $50000000 | $10, 525 loop ; 横列追加 pos 450,210 : objsize 25,40 : button gosub "<", *yokoretusakujyo OID.0 = stat pos 500,210 : objsize 25,40 : button gosub ">", *yokoretutuika OID.1 = stat ; 実行ボタン pos 120,210 : objsize 200,40 : button goto "実行", *check ; 実行結果表示 ◇mesbox 変数, 横幅サイズ, 高さサイズ, スタイル(0or1or5), 最大文字数◇ result="実行ボタンを押すことでこのエリアに結果が反映されます。" pos 5, 255 : mesbox result, 520, 220, 1, : mbID = stat gsel gsel 0, 1 stop *check ; htmlベース i1=0:i2=0 tabledata = "\<table>\n" repeat gyou+1 tabledata += "\t\<tr>\n" repeat retu tabledata += "\t\t<td>"+a.int(str(i1)+str(i2))+"</td>\n" i2++ loop i1++ :i2=0 tabledata += "\t\</tr>\n" loop tabledata += "\</table>" result= tabledata pos 25, 200 : objprm mbID, result stop *yokoretutuika i1=0 repeat gyou+1 aoidnum+=1 if (cnt=0){ a.int(str(i1)+str(retu)) = "タイトル"+str(i1)+str(retu) pos 5+(105*(retu)) , 25+30*i1 : input a.int(str(i1)+str(retu)), 100, 25 }else{ a.int(str(i1)+str(retu)) = "a"+str(i1)+str(retu) pos 5+(105*(retu)) , 25+30*i1 : input a.int(str(i1)+str(retu)), 100, 25 } i1++ aoid.aoidnum=stat loop retu+=1 return *yokoretusakujyo if(aoidnum && retu > 0){ clrobj aoid.(aoidnum-gyou), aoid.aoidnum aoidnum-=(gyou+1) retu-=1 } return end


overfllowスクロールボックスってウインドウをスクロールさせたいのかな?
http://hp.vector.co.jp/authors/VA043120/hpi_exhspobj.htm
http://quasiquote.org/hspwiki?%E3%82%A6%E3%82%A4%E3%83%B3%E3%83%89%E3%82%A6%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%90%E3%83%BC%E3%82%92%E4%BB%98%E3%81%91%E3%82%8B&l=en

アイデア
最初に行と列を入力するウインドウを表示(HTMLコードを表示するテキストボックスも表示)
作成ボタンで作成されるテーブルの入力画面は別ウインドウにしたら?
同時にCSSも編集できると尚良い
セルが行や列にまたがるときにはどうしよう?



ONION software Copyright 1997-2023(c) All rights reserved.