本文整理汇总了C++中BTextControl::StringWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ BTextControl::StringWidth方法的具体用法?C++ BTextControl::StringWidth怎么用?C++ BTextControl::StringWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BTextControl
的用法示例。
在下文中一共展示了BTextControl::StringWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rect
Window::Window()
: BWindow(BRect(100, 100, 590, 260), "EventMask-Test",
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{
BView* view = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(view);
BTextControl* textControl = new BTextControl(BRect(10, 10, 290, 30),
"text", "Type to test focus suspending:", "", NULL, B_FOLLOW_LEFT_RIGHT);
textControl->SetDivider(textControl->StringWidth(textControl->Label()) + 8);
view->AddChild(textControl);
textControl = new BTextControl(BRect(300, 10, 420, 30),
"all", "All keys:", "", NULL, B_FOLLOW_LEFT_RIGHT);
textControl->SetDivider(textControl->StringWidth(textControl->Label()) + 8);
view->AddChild(textControl);
textControl->TextView()->SetEventMask(B_KEYBOARD_EVENTS, 0);
BRect rect(10, 40, 120, 120);
for (int32 i = 0; i < 4; i++) {
uint32 options = 0;
switch (i) {
case 1:
options = B_SUSPEND_VIEW_FOCUS;
break;
case 2:
options = B_LOCK_WINDOW_FOCUS;
break;
case 3:
options = B_SUSPEND_VIEW_FOCUS | B_LOCK_WINDOW_FOCUS;
break;
}
fViews[i] = new PositionView(rect, options);
view->AddChild(fViews[i]);
rect.OffsetBy(120, 0);
}
BCheckBox* checkBox = new BCheckBox(BRect(10, 130, 200, 160), "permanent", "Get all pointer events", new BMessage(kMsgPointerEvents));
view->AddChild(checkBox);
}