Network: preselect first item, make device view resizable.

* After start, the first item will now be selected.
* The InterfaceAddressView will no longer restrict its width, so
  that the window doesn't have to be resized anymore when switching
  to it.
* This implements ticket #11923.
This commit is contained in:
Axel Dörfler
2015-03-31 18:00:23 +02:00
parent a526734858
commit 213f3cdb69
2 changed files with 10 additions and 4 deletions
@@ -74,7 +74,7 @@ InterfaceAddressView::InterfaceAddressView(int family,
fModeField->SetToolTip(
B_TRANSLATE("The method for obtaining an IP address"));
float minimumWidth = be_control_look->DefaultItemSpacing() * 16;
float minimumWidth = be_control_look->DefaultItemSpacing() * 15;
fAddressField = new IPAddressControl(fFamily, B_TRANSLATE("IP Address:"),
NULL);
@@ -96,8 +96,6 @@ InterfaceAddressView::InterfaceAddressView(int family,
fApplyButton = new BButton("apply", B_TRANSLATE("Apply"),
new BMessage(kMsgApply));
fApplyButton->SetExplicitAlignment(
BAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET));
fSettings.GetInterface(interface, fOriginalSettings);
_UpdateFields();
@@ -109,7 +107,10 @@ InterfaceAddressView::InterfaceAddressView(int family,
.AddTextControl(fNetmaskField, 0, 2, B_ALIGN_RIGHT)
.AddTextControl(fGatewayField, 0, 3, B_ALIGN_RIGHT)
.End()
.Add(fApplyButton)
.AddGroup(B_HORIZONTAL)
.AddGlue()
.Add(fApplyButton)
.End()
.AddGlue();
}
@@ -160,6 +160,11 @@ NetworkWindow::NetworkWindow()
_ScanAddOns();
_UpdateRevertButton();
fListView->Select(0);
_SelectItem(fListView->ItemAt(0));
// Call this manually, so that CenterOnScreen() below already
// knows the final window size.
// Set size of the list view from its contents
float width;
float height;