Thread Rating:
  • 279 Vote(s) - 2.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RichTextAreaについて
08-07-2018, 10:42 AM,
#1
RichTextAreaについて
こんにちは。

RichTextAreaについて質問があります。

RichTextArea内のフォントファミリードロップダウンやフォントサイズドロップダウンの内容を
変える方法を教えて頂きたいです。

もう1点、
初期値としてメイリオの22ptと設定する方法はあるのでしょうか?

ご教授よろしくお願いいたします。
08-21-2018, 08:10 PM, (This post was last modified: 08-21-2018, 08:11 PM by heavybugtracker.)
#2
RE: RichTextAreaについて
上記いずれも、RichTextArea.data-model (RichTextStringDataModel)の属性変更で実現可能と思います。
例:

Code:
{let rta:RichTextArea =
  {RichTextArea value={RichTextString.from-string "Tメイリョウ日本語22ptest"},
    {on AttachEvent do
      {(rta.data-model asa RichTextStringDataModel).set-attribute "font-family", "メイリオ"}
      {(rta.data-model asa RichTextStringDataModel).set-attribute "font-size", 22pt}

    }
  }
}

{value rta}
08-28-2018, 01:28 PM,
#3
RE: RichTextAreaについて
>heavybugtrackerさん

回答ありがとうございます!

例にあるサンプルコードを実行したところフォントやサイズが変更されました。
しかし、valueで設定している値を全て削除すると自動的にフォントとサイズが「sans-serif 10pt」になってしまいました。
※Value値が空だと自動的にフォントやサイズが変わるようです...
今回やりたいことはRichTextAreaを画面に表示しますが、フォントとサイズをプログラム内で指定し
ユーザーが入力するとき(空白状態から)はメイリオの22ptといった条件で入力することです。

追加質問があるのですが、
フォントとサイズのリスト内はどうやって編集すればよいでしょうか。
使わないフォントが沢山ありますのである程度数を絞って表示したり、
サイズも同様に使うものを絞りたいです。

以上、よろしくおねがいします!

10-12-2018, 07:06 PM, (This post was last modified: 10-12-2018, 07:14 PM by heavybugtracker.)
#4
RE: RichTextAreaについて
長い間見れてなく、ご回答が遅くなって失礼しました。

romさんのやりたいことはRichTextAreaのソースコードをCurlの開発環境の
インストールフォルダにあるOPEN-CONTROLSから取得し、改造する方が無難です。
(OPEN-CONTROLSのソースコードは通常次の場所にあります:
C:\Program Files (x86)\Curl Corporation\Surge\9\ide\gui\controls)


それが嫌でしたら、ハック的なやり方もあります。
Curlのグラフィック階層の考え方を利用して、対象のグラフィックを探すことです。

次のコードをご参考になれれば幸いです。
PHP Code:
{curl 8.0 applet}
{
define-proc public {find-target-in
                        g
:Box,
                        
t:Type,
                        
layer:int 5,
                        
sclass:String "rta-font-family-control",
                        
processed-layer:int}:#Box
    
    
set processed-layer processed-layer 1
    
{if processed-layer layer then
        
{return null}
    }

    {if-
non-null gc g.graphical-children then
        
{while true do
            {
def (child:anyeof?:bool) = {gc.read-one}}
            {
output "Child TYPE:" & {type-of child}}
            {
output "child style-class:" child.style-class}
            {
output "sclass:" sclass}
            
            {if {
type-of child} == and child.style-class == sclass then
                
{return child asa Box}
            }
            {if 
not (child isa Boxthen {continue}}
            {return
                {
find-target-in
                    child asa Box
,
                    
t,
                    
layer layer,
                    
sclass sclass,
                    
processed-layer
                
}
            }
        }
     else
        {return 
null}
    }
}

{
let rta:RichTextArea = {RichTextArea}}

{
spaced-vbox
    rta
,
    {
CommandButton
        
{on Action do
            || 
Get font-size dropdownlist
            
{def font-family-ddl =
                {
find-target-in rtaDropdownListlayer=6sclass="rta-font-family-control"0}
            }
            {
def font-size-ddl =
                {
find-target-in rtaDropdownListlayer=6sclass="rta-font-size-control"0}
            }
            {
output font-family-ddl}
            {
output font-size-ddl}
        }
    }


上記Font-familyおよびFont-sizeのドロップダウンリストのインスタンスを取得出来たら、中の値(リスト)が変更可能になりますので、ご期待の動きにはできるかと思います。

Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('1476')