CreateDialog setting title size/color?

94 views
Skip to first unread message

wheelie tips

unread,
Dec 18, 2021, 4:02:43 AM12/18/21
to DroidScript
Hi,

I try to change the Dialog's title size and color, but it seems to be ignored, for example:

function OnStart()
{
    dlg = app.CreateDialog( "Change My Size and Color" );
    dlg.SetTitleColor("green")
    dlg.SetTitleTextSize ( 20 )
    layDlg = app.CreateLayout( "linear", "VCenter,FillXY" );
    layDlg.SetSize( 0.8, 0.5 );
    dlg.AddLayout( layDlg );
    btnDlg = app.CreateButton( "Close", 0.6, 0.07 );
    btnDlg.SetOnTouch( btnDlg_OnTouch );
    layDlg.AddChild( btnDlg );
    dlg.Show();
}

function btnDlg_OnTouch()
{
    dlg.Dismiss();
}

ddlg.png

Is it me (once again)?
Cheers,
WT

Steve Garman

unread,
Dec 18, 2021, 4:53:39 AM12/18/21
to DroidScript
No I don't think it is you. They don't work, at least in recent versions of Android

They stopped working in or before the 1.30 beta

I think there was discussion that the color at least may be almost impossible to fix but I don't remember the detail. I just have tantalising memory of discussion of "themeing problems"

I remember having to implement fixes by
creating dialogs with the NoTitle option,
adding a main layout to the dialog that could be resized,
adding a pseudo title bar to the main layout

Somewhere that fell off my radar because standard dialogs are much better than they used to be

In my capacity as a beta tester I apologise but in the short term I suspect the documentation is more likely to be fixed than the functionality

I would be delighted if Dave can tell me I'm wrong about this
Message has been deleted
Message has been deleted

wheelie tips

unread,
Dec 18, 2021, 5:11:11 AM12/18/21
to DroidScript
Thx Steve, I tried to reply twice but messages are auto-deleted; I don't understand this platform.

anyways, many thanks for the clarifications.
Best,
WT

Alan Hendry

unread,
Dec 18, 2021, 10:22:04 AM12/18/21
to DroidScript
HI,
To work around have you tried option Old on the Create, and px on SetTitleTextSize?
Also Dialogs allow .Method (not sure what the name should be, or how to apply it to the Title)
And the docs say
SetTitleColor "Changes the color of the title divider." (probably doesn't mean divider)
Regards, ah

wheelie tips

unread,
Dec 18, 2021, 10:47:35 AM12/18/21
to DroidScript
Hi Alan!

well, trying the 'Old' option did change the text size :)

regarding the color, both following commands affect the divider only:

dlg.SetTitleColor("green")
dlg.SetTitleDividerColor("red")

for example, larger text but the title didn't change color only the divider:
ddlg.png

function OnStart()
{
    dlg = app.CreateDialog( "Change My Size and Color" , "Old");
    dlg.SetTitleColor("green")
    dlg.SetTitleDividerColor("red")

    dlg.SetTitleTextSize ( 20 )
    layDlg = app.CreateLayout( "linear", "VCenter,FillXY" );
    layDlg.SetSize( 0.8, 0.5 );
    dlg.AddLayout( layDlg );
    btnDlg = app.CreateButton( "Close", 0.6, 0.07 );
    btnDlg.SetOnTouch( btnDlg_OnTouch );
    layDlg.AddChild( btnDlg );
    dlg.Show();
}

function btnDlg_OnTouch()
{
    dlg.Dismiss();
}
////////////////////////////////////////////////////

Alan Hendry

unread,
Dec 18, 2021, 11:57:29 AM12/18/21
to DroidScript
HI,
You could try drawers, layouts (card), etc
they'd all need text a box for the title, 
and probably an empty text box of width 1 height 0.01 with a background colour for the divider
(or use Premium MUI Divider)
Regards, ah

Dave

unread,
Dec 18, 2021, 12:22:52 PM12/18/21
to DroidScript
You need to use themes to change the dialog text colors, size etc.

wheelie tips

unread,
Dec 18, 2021, 1:55:10 PM12/18/21
to DroidScript
Thank you both for your input and suggestions! I'll keep on playing with :)
Cheers,
WT

Dave

unread,
Dec 21, 2021, 12:36:16 PM12/21/21
to DroidScript
This one is related to needing the dialog visible before you can set the color, try this - 

function OnStart()
{
    dlg = app.CreateDialog( "Change My Size and Color" , "Old");
   
    layDlg = app.CreateLayout( "linear", "VCenter,FillXY" );
    layDlg.SetSize( 0.8, 0.5 );
    dlg.AddLayout( layDlg );
    btnDlg = app.CreateButton( "Close", 0.6, 0.07 );
    btnDlg.SetOnTouch( btnDlg_OnTouch );
    layDlg.AddChild( btnDlg );
    dlg.Show();
    dlg.SetTitleTextSize ( 20 )

    dlg.SetTitleColor("green")
    dlg.SetTitleDividerColor("red")
}

function btnDlg_OnTouch()
{
    dlg.Dismiss();
}



Also, this should work across all your dialog types -

 theme.SetTitleColor( "red" )

wheelie tips

unread,
Dec 21, 2021, 3:00:57 PM12/21/21
to DroidScript
Dave, that is precisely what i was aiming for :)
appreciate your working example!
Cheers,
WT


Reply all
Reply to author
Forward
0 new messages