mirror of
https://github.com/LorenzCK/OnTopReplica.git
synced 2024-05-11 07:53:20 +12:00
Issue #53: fixed combo box selection (it is now reset when stored region is deleted).
This commit is contained in:
parent
7df96b420f
commit
c347634c30
|
@ -72,6 +72,9 @@ namespace OnTopReplica.Native {
|
|||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern IntPtr GetParent(IntPtr hWnd);
|
||||
|
||||
[DllImport("User32", CharSet = CharSet.Auto)]
|
||||
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndParent);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = false)]
|
||||
public static extern bool SetForegroundWindow(IntPtr hwnd);
|
||||
|
||||
|
@ -99,5 +102,7 @@ namespace OnTopReplica.Native {
|
|||
return (!hasParent && !hasOwner);
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr FindWindow(string className, string windowName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace OnTopReplica.Native {
|
|||
[Flags]
|
||||
public enum WindowStyles : long {
|
||||
None = 0,
|
||||
Child = 0x40000000L,
|
||||
Disabled = 0x8000000L,
|
||||
Minimize = 0x20000000L,
|
||||
MinimizeBox = 0x20000L,
|
||||
|
|
|
@ -239,11 +239,10 @@ namespace OnTopReplica.SidePanels {
|
|||
return;
|
||||
|
||||
var origIndex = comboRegions.SelectedIndex;
|
||||
comboRegions.SelectedIndex = -1;
|
||||
|
||||
Settings.Default.SavedRegions.RemoveAt(origIndex);
|
||||
comboRegions.Items.RemoveAt(origIndex);
|
||||
|
||||
if (comboRegions.Items.Count > 0)
|
||||
comboRegions.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void Save_click(object sender, EventArgs e) {
|
||||
|
@ -288,11 +287,11 @@ namespace OnTopReplica.SidePanels {
|
|||
buttonDelete.Enabled = (comboRegions.SelectedIndex >= 0);
|
||||
|
||||
if (comboRegions.SelectedIndex >= 0) {
|
||||
//Load region
|
||||
var region = comboRegions.SelectedItem as StoredRegion;
|
||||
|
||||
if (region == null)
|
||||
if (region == null) {
|
||||
Log.Write("Stored region at index {0} does not contain a valid StoredRegion instance (object is {2})", comboRegions.SelectedIndex, comboRegions.SelectedItem);
|
||||
return;
|
||||
}
|
||||
|
||||
SetRegion(region.Region);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue