-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popup Component and dlgEnter Implementation #5878
Merged
lloyddewit
merged 11 commits into
IDEMSInternational:master
from
Patowhiz:UcrPopupAndDlgEnter
Aug 30, 2020
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7fb5cf8
Merge pull request #147 from africanmathsinitiative/master
conlooptechnologies c14c308
Merge pull request #148 from africanmathsinitiative/master
conlooptechnologies e807046
Merge pull request #152 from africanmathsinitiative/master
conlooptechnologies ea928cf
pop up empty class
conlooptechnologies b86a16a
Popup implementation and dlgEnter
conlooptechnologies c278a8e
Fixed bug and tooltips temporary place holders changes
conlooptechnologies f208a9c
index change
conlooptechnologies 0c80c66
Data label designer change
conlooptechnologies 1c10b48
designer changes
conlooptechnologies 8bc2b81
Update instat/clsPopup.vb
conlooptechnologies 4e02596
proposed comments additions and formatting
conlooptechnologies File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
' R- Instat | ||
' Copyright (C) 2015-2017 | ||
' | ||
' This program is free software: you can redistribute it and/or modify | ||
' it under the terms of the GNU General Public License as published by | ||
' the Free Software Foundation, either version 3 of the License, or | ||
' (at your option) any later version. | ||
' | ||
' This program is distributed in the hope that it will be useful, | ||
' but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
' GNU General Public License for more details. | ||
' | ||
' You should have received a copy of the GNU General Public License | ||
' along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
'''-------------------------------------------------------------------------------------------- | ||
''' <summary> | ||
''' An object of this class represents a popup component that's used and displayed as a control. | ||
''' <list type="bullet"> | ||
''' <item><description> | ||
''' set contents control of the popup | ||
''' </description></item> | ||
''' <item><description> | ||
''' set size of the popup | ||
''' </description></item> | ||
''' <item><description> | ||
''' specify the display position of the popup relative to the owner. Default is top | ||
''' </description></item> | ||
''' <item><description> | ||
''' attach the owner control and show the popup | ||
''' </description></item> | ||
''' </list> | ||
''' </summary> | ||
'''-------------------------------------------------------------------------------------------- | ||
Public Class clsPopup | ||
''' <summary> | ||
''' Event raised when the contents control loses focus. | ||
''' This indicates that the popup is closing. | ||
'''</summary> | ||
Public Event Closing() | ||
|
||
''' <summary> | ||
''' Container used as the 'frame' of the popup component | ||
''' </summary> | ||
Private ReadOnly frm As Form | ||
|
||
''' <summary> | ||
''' specifies if the popup should hide automatically on lost focus or not | ||
''' </summary> | ||
Public Property AutoHide As Boolean | ||
|
||
''' <summary> | ||
''' specifies the position of the popup relative to the owner(control) | ||
''' </summary> | ||
Public Property Position As PopupPosition | ||
|
||
''' <summary> | ||
''' enumeration of allowable popup positions | ||
''' </summary> | ||
Public Enum PopupPosition | ||
Top | ||
Below | ||
End Enum | ||
|
||
Sub New() | ||
'initialise variables and set defaults | ||
frm = New Form With { | ||
.ShowInTaskbar = False, | ||
.FormBorderStyle = FormBorderStyle.None, | ||
.StartPosition = FormStartPosition.Manual | ||
} | ||
'set default popup behaviours | ||
AutoHide = True | ||
Position = PopupPosition.Top | ||
End Sub | ||
|
||
Public Sub SetSize(width As Integer, height As Integer) | ||
SetSize(New Size(width, height)) | ||
End Sub | ||
|
||
Public Sub SetSize(size As Size) | ||
frm.Size = size | ||
End Sub | ||
|
||
Public Sub SetLocation(x As Integer, y As Integer) | ||
SetLocation(New Point(x, y)) | ||
End Sub | ||
|
||
Public Sub SetLocation(point As Point) | ||
frm.Location = point | ||
End Sub | ||
|
||
''' <summary> | ||
''' sets the specified control as the contents control of the popup | ||
''' </summary> | ||
''' <param name="ctr">The System.Windows.Forms.Control to set as the control contained in the popup</param> | ||
Public Sub SetContentControl(ctr As Control) | ||
frm.Controls.Clear() 'remove any existing control first | ||
frm.Controls.Add(ctr) | ||
ctr.Dock = DockStyle.Fill 'the control will always be same size as the from | ||
|
||
'attach the event handler that will determine auto closing | ||
AddHandler ctr.LostFocus, Sub() | ||
If AutoHide Then | ||
Hide() | ||
End If | ||
End Sub | ||
End Sub | ||
|
||
''' <summary> | ||
''' shows the popup relative to the location of the specified control(owner) | ||
''' and the position specified | ||
''' </summary> | ||
''' <param name="owner">The System.Windows.Forms.Control to set popup location based on</param> | ||
''' <param name="position">PopupPosition to set the position of the popup</param> | ||
Public Sub Show(owner As Control, position As PopupPosition) | ||
Me.Position = position | ||
Show(owner) | ||
End Sub | ||
|
||
''' <summary> | ||
''' shows the popup relative to the location of the specified control(owner) | ||
''' and the position set | ||
''' </summary> | ||
''' <param name="owner">The System.Windows.Forms.Control to set popup location based on</param> | ||
Public Sub Show(owner As Control) | ||
'compute and get the location of the specified control relative to screen coordinates | ||
'Don't use Point.Empty, it's not function so use Point(0, 0) | ||
Dim ctrPos As Point = owner.PointToScreen(New Point(0, 0)) | ||
|
||
'then set location of the popup relative to the position specified | ||
Select Case Position | ||
Case PopupPosition.Top | ||
SetLocation(ctrPos.X - 2, ctrPos.Y - frm.Height - 2) | ||
Case PopupPosition.Below | ||
SetLocation(ctrPos.X - 2, ctrPos.Y + owner.Height - 2) | ||
End Select | ||
|
||
'then show popup | ||
frm.Show() | ||
End Sub | ||
|
||
''' <summary> | ||
''' raises popup hiding event then hides the popup | ||
''' </summary> | ||
Public Sub Hide() | ||
RaiseEvent Closing() | ||
frm.Close() | ||
End Sub | ||
|
||
End Class |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add XML comment for class (see RCodeStructure for example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done