Jump to content

How to make a round corner for UnimPanel?


55143681

Recommended Posts

As you know,the follow code can make a round corner for UniPanel(Desktop),

But,have no effect for UnimPanel(Mobile),

How to make a round corner for UnimPanel?

 cbuilder:

newPanel->ClientEvents->ExtEvents->Values["afterrender"]="function(sender){sender.body.dom.style.borderRadius=\"10px\"}";
delphi:

ClientEvents.ExtEvents.Values['afterrender'] := 'function(sender){sender.body.dom.style.borderRadius="10px"}';

Link to comment
Share on other sites

  • 2 weeks later...
On 5/12/2020 at 6:50 PM, Sherzod said:

It's JS property... 

UnimPanel1.JSInterface.JSCode(#1'.bodyElement.dom.style.setProperty("border-color", "red", "important");');

 

UnimPanel1.JSInterface.JSCode(#1'.bodyElement.dom.style.setProperty("border-radius","10px");');
UnimPanel1.JSInterface.JSCode(#1'.bodyElement.setStyle("border-radius","10px");');

Link to comment
Share on other sites

If I put UnimPanel1 in a form,the code has effect,

but,

If I create the UnimPanel dynamicly,the code has no effect,

why?

the code:

    //生成UnimPanel
  newPanel:=TUnimPanel.Create(Self);
    newPanel.Name:=concat('newPanel',ownerNo);//关联到唯一编号上,便于知道点击了谁
    newPanel.Parent:=UnimScrollBox1;
    newPanel.Height:=panelHeight;
    newPanel.BorderStyle:=ubsDefault;//ubsNone 可以取消边框
    newPanel.Align:=alTop;
    newPanel.AlignWithMargins:=true;//保留边界空间
    newPanel.OnMouseDown:=showDetail;//设置点击函数
  newPanel.JSInterface.JSCode(#1'.bodyElement.dom.style.setProperty("border-color", "red", "important");');
  newPanel.JSInterface.JSCode(#1'.bodyElement.dom.style.setProperty("border-radius","10px");');

Link to comment
Share on other sites

1 hour ago, 55143681 said:

If I put UnimPanel1 in a form,the code has effect,

but,

If I create the UnimPanel dynamicly,the code has no effect,

why?

the code:

    //生成UnimPanel
  newPanel:=TUnimPanel.Create(Self);
    newPanel.Name:=concat('newPanel',ownerNo);//关联到唯一编号上,便于知道点击了谁
    newPanel.Parent:=UnimScrollBox1;
    newPanel.Height:=panelHeight;
    newPanel.BorderStyle:=ubsDefault;//ubsNone 可以取消边框
    newPanel.Align:=alTop;
    newPanel.AlignWithMargins:=true;//保留边界空间
    newPanel.OnMouseDown:=showDetail;//设置点击函数
  newPanel.JSInterface.JSCode(#1'.bodyElement.dom.style.setProperty("border-color", "red", "important");');
  newPanel.JSInterface.JSCode(#1'.bodyElement.dom.style.setProperty("border-radius","10px");');

Move the code from OnBeforeShow to OnShow will works fine.

for cbuilder:

newPanel->JSInterface->JSCode(String(newPanel->JSName )+".bodyElement.dom.style.setProperty(\"border-color\",\"gray\",\"important\");");
newPanel->JSInterface->JSCode(String(newPanel->JSName )+".bodyElement.dom.style.setProperty(\"border-radius\",\"5px\");");

for delphi:

  newPanel.JSInterface.JSCode(#1'.bodyElement.dom.style.setProperty("border-color", "red", "important");');
  newPanel.JSInterface.JSCode(#1'.bodyElement.dom.style.setProperty("border-radius","10px");');

Link to comment
Share on other sites

.mainbutton {
	margin: 5px 10px 10px 5px;
	border-radius: 15px;
	padding: 10px 0px 0px 0px;
	max-width: 40%;
	min-width: 128px;
	box-shadow: 3px 4px 7px 1px #b0b0b0;
	/*background-color: white!important;*/
}

border-radius +  LayoutConfig.Cls

Screenshot_16.jpg

Link to comment
Share on other sites

 

12 hours ago, 55143681 said:

If I put UnimPanel1 in a form,the code has effect,

but,

If I create the UnimPanel dynamicly,the code has no effect,

why?

the code:

    //生成UnimPanel
  newPanel:=TUnimPanel.Create(Self);
    newPanel.Name:=concat('newPanel',ownerNo);//关联到唯一编号上,便于知道点击了谁
    newPanel.Parent:=UnimScrollBox1;
    newPanel.Height:=panelHeight;
    newPanel.BorderStyle:=ubsDefault;//ubsNone 可以取消边框
    newPanel.Align:=alTop;
    newPanel.AlignWithMargins:=true;//保留边界空间
    newPanel.OnMouseDown:=showDetail;//设置点击函数
  newPanel.JSInterface.JSCode(#1'.bodyElement.dom.style.setProperty("border-color", "red", "important");');
  newPanel.JSInterface.JSCode(#1'.bodyElement.dom.style.setProperty("border-radius","10px");');

 

Try this

newPanel.ClientEvents.UniEvents.Add('beforeInit=function beforeInit(sender, config){sender.cls="YOURCSS CLASS";}')

 

Link to comment
Share on other sites

On 5/23/2020 at 9:10 PM, x11 said:

.mainbutton {
	margin: 5px 10px 10px 5px;
	border-radius: 15px;
	padding: 10px 0px 0px 0px;
	max-width: 40%;
	min-width: 128px;
	box-shadow: 3px 4px 7px 1px #b0b0b0;
	/*background-color: white!important;*/
}

border-radius +  LayoutConfig.Cls

Screenshot_16.jpg

thank you .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...