不同单选按钮列表中的单选按钮对齐方式

huangapple go评论46阅读模式
英文:

Alignment of radio buttons in different radio lists

问题

两个问题的翻译:

问题1:两个单选按钮列表,第二个单选按钮未对齐。以下是代码和屏幕截图。dm4和No的单选按钮未对齐。

问题2:尝试使用DLGCreateRadioItem而不是DLGAddRadioItem,但不起作用。

英文:

all
I'd like to create two radio lists. Each list has two radio items. But the radio buttons of the second items are not aligned. Here is the code and screen shot. The radio button of dm4 and No are not aligned.

不同单选按钮列表中的单选按钮对齐方式

// Creating radio of format
TagGroup Dm3OrDm4, Dm3OrDm4Items
Dm3OrDm4 = DLGCreateRadioList(Dm3OrDm4Items,0).DLGAnchor("West")
Dm3OrDm4.DLGIdentifier( "#Dm3OrDm4" )
Dm3OrDm4Items.DLGAddRadioItem("dm3", 0).DLGSide("Left")
Dm3OrDm4Items.DLGAddRadioItem("dm4", 1).DLGSide("Left")
Dm3OrDm4.DLGTableLayOut(2,2,1)

// Creating radio of subfolder
TagGroup Subfolder, SubfolderItems
Subfolder = DLGCreateRadioList(SubfolderItems,1).DLGAnchor("West")
Subfolder.DLGIdentifier( "#Subfolder" )
SubfolderItems.DLGAddRadioItem("Yes", 0).DLGSide("Left")
SubfolderItems.DLGAddRadioItem("No", 1).DLGSide("Left")
Subfolder.DLGTableLayOut(2,1,1)

// Create box of conversion method
TagGroup Method, MethodItems
Method = DLGCreateBox("Method",MethodItems)
MethodItems.DLGAddElement(DLGCreateLabel("Output format").DLGAnchor("East"))
MethodItems.DLGAddElement(Dm3OrDm4)
MethodItems.DLGAddElement(DLGCreateLabel("Output to subfolder").DLGAnchor("East"))
MethodItems.DLGAddElement(Subfolder)
Method.DLGTableLayOut(2,2,1)

I tried to use DLGCreateRadioItem instead of DLGAddRadioItem. But it doesn't work.

TagGroup Dm3OrDm4Group, Dm3OrDm4GroupItems
Dm3OrDm4Group = DLGCreateGroup( Dm3OrDm4GroupItems ).DLGAnchor("East")
Dm3OrDm4Group.DLGIdentifier( "#Dm3OrDm4" )
Dm3OrDm4GroupItems.DLGAddElement(DLGCreateRadioItem("dm3", 0))
Dm3OrDm4GroupItems.DLGAddElement(DLGCreateLabel("dm3"))
Dm3OrDm4GroupItems.DLGAddElement(DLGCreateRadioItem("dm4", 1))
Dm3OrDm4GroupItems.DLGAddElement(DLGCreateLabel("dm4"))
Dm3OrDm4Group.DLGLayout( DLGCreateTableLayout( 4, 1, 0 ) )

答案1

得分: 1

抱歉,您提供的内容中包含代码,我会为您翻译除代码部分以外的文本。以下是翻译好的部分:

"Unfortunately there is no way to automatically "align" these items on a grid, as they are not part of the same "table&quot." - "不幸的是,由于它们不属于同一“表格”,没有自动将这些项目在网格上“对齐”的方法。"

"The only thing to align them is by manually tweaking the "width" of the individual radio-items so that they match up." - "唯一对齐它们的方法是手动调整各个单选按钮项的“宽度”,使它们相匹配。"

"This can best be done by using DLGInternalPadding and DLGExternalPadding." - "最好使用 DLGInternalPaddingDLGExternalPadding 来完成这个任务。"

"f.e. like this:" - "例如,像这样:"

[class Dlg:UIFrame... - 代码部分,不进行翻译。

"Alloc(dlg).Show()" - 代码部分,不进行翻译。

英文:

Unfortunately there is no way to automatically "align" these items on a grid, as they are not part of the same "table". This becomes clearer, when looking at the actual taggroup describing the dialog:

不同单选按钮列表中的单选按钮对齐方式

The only thing to align them is by manually tweaking the "width" of the individual radio-items so that they match up. This can best be done by using DLGInternalPadding and DLGExternalPadding.

f.e. like this:

class Dlg:UIFrame
{
	Taggroup CreateDLGTagGroup(object self)
	{
		// Creating radio of format
		TagGroup Dm3OrDm4, Dm3OrDm4Items
		Dm3OrDm4 = DLGCreateRadioList(Dm3OrDm4Items,0)
		Dm3OrDm4.DLGIdentifier( "#Dm3OrDm4" )
		Dm3OrDm4Items.DLGAddRadioItem("dm3", 0).DLGSide("Left")
		Dm3OrDm4Items.DLGAddRadioItem("dm4", 1)
	
		// Creating radio of subfolder
		TagGroup Subfolder, SubfolderItems
		Subfolder = DLGCreateRadioList(SubfolderItems,1)
		Subfolder.DLGIdentifier( "#Subfolder" )
		SubfolderItems.DLGAddRadioItem("Yes ", 0).DLGSide("Left").DLGExternalPadding(1,0)
		SubfolderItems.DLGAddRadioItem("No", 1)
		subfolder.DLGSide("Left")
	
		// Create box of conversion method
		TagGroup Method, MethodItems
		Method = DLGCreateBox("Method",MethodItems)
		MethodItems.DLGAddElement(DLGCreateLabel("Output format").DLGAnchor("East"))
		MethodItems.DLGAddElement(Dm3OrDm4.DLGAnchor("West"))
		MethodItems.DLGAddElement(DLGCreateLabel("Output to subfolder").DLGAnchor("East"))
		MethodItems.DLGAddElement(Subfolder.DLGAnchor("West"))
		Method.DLGTableLayOut(2,2,0)
		
		return method
	}

	void Show(object self)
	{
		self.init( self.CreateDLGTagGroup() ).display("Test (new)")
	}
} 

Alloc(dlg).Show()

不同单选按钮列表中的单选按钮对齐方式

huangapple
  • 本文由 发表于 2023年4月4日 12:56:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/75925640.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定