diff --git a/comp/src/gb.web.form/.info b/comp/src/gb.web.form/.info
index 86c52d71b..2dba5359d 100644
--- a/comp/src/gb.web.form/.info
+++ b/comp/src/gb.web.form/.info
@@ -1196,6 +1196,10 @@ _GetJavascriptFiles
m
String[]
+_GetJavascriptExternFiles
+m
+String[]
+
AddJavascriptFile
m
@@ -1794,6 +1798,10 @@ AddColumn
m
_WebTableColumn
(Text)s[(Width)s(Alignment)i]
+EnsureVisible
+m
+
+(Row)i
#WebTableData
C
diff --git a/comp/src/gb.web.form/.project b/comp/src/gb.web.form/.project
index 8c8d00b37..453590af1 100644
--- a/comp/src/gb.web.form/.project
+++ b/comp/src/gb.web.form/.project
@@ -1,6 +1,6 @@
# Gambas Project File 3.0
# Compiled with Gambas 3.9.90
-Startup=Webform3
+Startup=Webform6
UseHttpServer=1
Version=3.9.90
VersionFile=1
diff --git a/comp/src/gb.web.form/.src/Calendar/WebDateBox.class b/comp/src/gb.web.form/.src/Calendar/WebDateBox.class
index a09af8517..8807aa2bb 100644
--- a/comp/src/gb.web.form/.src/Calendar/WebDateBox.class
+++ b/comp/src/gb.web.form/.src/Calendar/WebDateBox.class
@@ -83,6 +83,7 @@ Private Sub Date_Write(Value As Date)
$dDate = Value
Me._SetProperty("Date", Value)
+ Raise Change
End
diff --git a/comp/src/gb.web.form/.src/Header.class b/comp/src/gb.web.form/.src/Header.class
index 4fcc6e7aa..7c6ebdb46 100644
--- a/comp/src/gb.web.form/.src/Header.class
+++ b/comp/src/gb.web.form/.src/Header.class
@@ -19,5 +19,18 @@ Private Sub GetJavascript() As String
aFiles = Form._GetJavascriptFiles()
If aFiles And If aFiles.Count Then Return ":" & aFiles.Join(":")
-
+End
+
+Private Sub PrintJavascriptExternFiles()
+
+ Dim aFiles As String[]
+ Dim sFile As String
+
+ aFiles = Form._GetJavascriptExternFiles()
+ If aFiles Then
+ For Each sFile In aFiles
+ Print ""
+ Next
+ Endif
+
End
diff --git a/comp/src/gb.web.form/.src/Header.webpage b/comp/src/gb.web.form/.src/Header.webpage
index c285ee57e..ea8157f6a 100644
--- a/comp/src/gb.web.form/.src/Header.webpage
+++ b/comp/src/gb.web.form/.src/Header.webpage
@@ -7,5 +7,6 @@
">
+ <%PrintJavascriptExternFiles()%>
<%=GetTitle()%>
diff --git a/comp/src/gb.web.form/.src/Test/Webform6.class b/comp/src/gb.web.form/.src/Test/Webform6.class
index 33135fc2a..10218be34 100644
--- a/comp/src/gb.web.form/.src/Test/Webform6.class
+++ b/comp/src/gb.web.form/.src/Test/Webform6.class
@@ -1,22 +1,14 @@
' Gambas class file
-Public Sub WebTextBox1_Completion(Text As String)
-
- Dim aList As String[]
- Dim I As Integer
-
- aList = New String[]
- For I = 1 To 10
- aList.Add(Text & "-" & Chr$(64 + I))
- Next
-
- WebTextBox1.CompleteWith(aList)
-
-End
-
Public Sub WebForm_Open()
WebForm.Debug = True
End
+
+Public Sub WebComboBox1_Click()
+
+ Debug
+
+End
diff --git a/comp/src/gb.web.form/.src/Test/Webform6.webform b/comp/src/gb.web.form/.src/Test/Webform6.webform
index 62733b2e5..ed24b998a 100644
--- a/comp/src/gb.web.form/.src/Test/Webform6.webform
+++ b/comp/src/gb.web.form/.src/Test/Webform6.webform
@@ -5,28 +5,8 @@
Arrangement = Arrange.Vertical
Margin = True
Spacing = True
- { panStop WebContainer
- #MoveScaled(1,1,72,6)
- Background = Color.Red
- Arrangement = Arrange.Horizontal
- Spacing = True
- { btnRadio WebButton
- #MoveScaled(1,1,16,4)
- Text = ("Stop radio")
- }
- { btnLogout WebButton
- #MoveScaled(18,1,11,4)
- Text = ("Logout") & "..."
- Image = "favicon.png"
- }
- }
- { WebTextBox1 WebTextBox
- #MoveScaled(1,8,72,4)
- ShowClear = True
- }
{ WebComboBox1 WebComboBox
- #MoveScaled(1,13,72,4)
+ #MoveScaled(1,1,72,4)
List = [("Élément 1"), ("Élément 2"), ("Élément 3")]
- ReadOnly = False
}
}
diff --git a/comp/src/gb.web.form/.src/WebForm.class b/comp/src/gb.web.form/.src/WebForm.class
index 8c7a176fe..fe30d3083 100644
--- a/comp/src/gb.web.form/.src/WebForm.class
+++ b/comp/src/gb.web.form/.src/WebForm.class
@@ -44,6 +44,7 @@ Public _Loaded As Boolean
Public _Window As Integer
Private $aJavascriptFiles As String[]
+Private $aJavascriptExternfiles As String[]
Private $sTitle As String
Private $bResizable As Boolean
@@ -798,11 +799,22 @@ Public Sub _GetJavascriptFiles() As String[]
End
+Public Sub _GetJavascriptExternFiles() As String[]
+
+ Return $aJavascriptExternFiles
+
+End
+
Public Sub AddJavascriptFile(sFile As String)
- If sFile Ends ".js" Then sFile = Left(sFile, -3)
- If Not $aJavascriptFiles Then $aJavascriptFiles = New String[]
- $aJavascriptFiles.Add(sFile)
+ If sFile Begins "http://" Or If sFile Begins "https://" Then
+ If Not $aJavascriptExternFiles Then $aJavascriptExternFiles = New String[]
+ $aJavascriptExternFiles.Add(sFile)
+ Else
+ If sFile Ends ".js" Then sFile = Left(sFile, -3)
+ If Not $aJavascriptFiles Then $aJavascriptFiles = New String[]
+ $aJavascriptFiles.Add(sFile)
+ Endif
End
diff --git a/comp/src/gb.web.form/.src/WebTable/WebTable.class b/comp/src/gb.web.form/.src/WebTable/WebTable.class
index 5428deaea..76657d077 100644
--- a/comp/src/gb.web.form/.src/WebTable/WebTable.class
+++ b/comp/src/gb.web.form/.src/WebTable/WebTable.class
@@ -38,7 +38,7 @@ Private $iScrollY As Integer
Private $bNoScrolling As Boolean
Private $bNoCheck As Boolean
Private $bNoHeader As Boolean
-
+Private $iEnsureVisible As Integer = -1
Public Sub _new()
@@ -170,7 +170,12 @@ Public Sub _Render()
If $bNoScrolling Then
$bNoScrolling = False
Else
- WebForm._AddJavascript("gw.table.scroll(" & JS(Me.Name) & "," & JS($iScrollX) & "," & JS($iScrollY) & ")")
+ If $iEnsureVisible > 0 Then
+ WebForm._AddJavascript("gw.table.ensureVisible(" & JS(Me.Name) & "," & CStr($iEnsureVisible) & ")")
+ $iEnsureVisible = -1
+ Else
+ WebForm._AddJavascript("gw.table.scroll(" & JS(Me.Name) & "," & JS($iScrollX) & "," & JS($iScrollY) & ")")
+ Endif
Endif
If $iMode = Select.Single Then WebForm._AddJavascript("$(" & JS(Me.Name) & ").gw_current = " & Current_Read())
@@ -532,6 +537,15 @@ Public Sub AddColumn(Text As String, Optional Width As String, Alignment As Inte
hCol.Alignment = Alignment
Return hCol
-
+
+End
+
+Public Sub EnsureVisible(Row As Integer)
+
+ If Row < 0 Or If Row >= $iCount Then Return
+
+ Me.Display = Min($iCount, Max($iStep, ((Row + $iStep - 1) \ $iStep) * $iStep))
+ Me.Refresh
+ $iEnsureVisible = Row
End
diff --git a/comp/src/gb.web.form/.startup b/comp/src/gb.web.form/.startup
index 766db0b24..f94dff615 100644
--- a/comp/src/gb.web.form/.startup
+++ b/comp/src/gb.web.form/.startup
@@ -1,4 +1,4 @@
-Webform3
+Webform6
0
0
diff --git a/comp/src/gb.web.form/lib.js b/comp/src/gb.web.form/lib.js
index a37705dc1..e48e0e299 100644
--- a/comp/src/gb.web.form/lib.js
+++ b/comp/src/gb.web.form/lib.js
@@ -44,6 +44,17 @@ Element.prototype.removeClass = function(klass)
}
};
+/*Element.prototype.ensureVisible = function()
+{
+ var parent = this.offsetParent;
+
+ while (parent && parent.clientHeight == parent.scrollHeight && parent.clientWidth == parent.scrollWidth)
+ parent = parent.offsetParent;
+
+ if (parent)
+ gw.ensureVisible(this.offsetParent, this.offsetLeft, this.offsetTop, this.offsetWidth, this.offsetHeight);
+};*/
+
gw = {
version: '0',
@@ -454,6 +465,95 @@ gw = {
return { found: found, left: left, top: top, width: width, height: height, right: left + width, bottom: top + height };
},
+ /*ensureVisible: function(id, x, y, w, h)
+ {
+ var elt = typeof(id) == 'string' ? $(id) : id;
+ var pw, ph,cx, cy, cw, ch;
+ var xx, yy, ww, hh;
+
+ // WW = W / 2
+ ww = w / 2;
+ //HH = H / 2
+ hh = h / 2;
+ // XX = X + WW
+ xx = x + ww
+ // YY = Y + HH
+ yy = y + hh;
+
+ // PW = Me.ClientW
+ // PH = Me.ClientH
+ pw = elt.clientWidth;
+ ph = elt.clientHeight;
+
+ cx = - elt.scrollLeft;
+ cy = - elt.scrollTop;
+ cw = elt.scrollWidth;
+ ch = elt.scrollHeight;
+
+ //If PW < (WW * 2) Then WW = PW / 2
+ //If PH < (HH * 2) Then HH = PH / 2
+ if (pw < (ww * 2)) ww = pw / 2;
+ if (ph < (hh * 2)) hh = ph / 2;
+
+ //If CW <= PW Then
+ // WW = 0
+ // CX = 0
+ //Endif
+ if (cw <= pw) { ww = 0; cx = 0; }
+
+ //If CH <= PH Then
+ // HH = 0
+ // CY = 0
+ //Endif
+ if (ch <= ph) { hh = 0; cy = 0 }
+
+ //If XX < (- CX + WW) Then
+ // CX = Ceil(- XX + WW)
+ //Else If XX >= (- CX + PW - WW) Then
+ // CX = Floor(- XX + PW - WW)
+ //Endif
+ if (xx < (- cx + ww))
+ cx = - xx + ww;
+ else if (xx >= (- cx + pw - ww))
+ cx = - xx + pw - ww;
+
+ //If YY < (- CY + HH) Then
+ // CY = Ceil(- YY + HH)
+ //Else If YY >= (- CY + PH - HH) Then
+ // CY = Floor(- YY + PH - HH)
+ //Endif
+
+ if (yy < (- cy + hh))
+ cy = - yy + hh;
+ else if (yy >= (- cy + ph - hh))
+ cy = - yy + ph - hh;
+
+ //If CX > 0
+ // CX = 0
+ //Else If CX < (PW - CW) And If CW > PW Then
+ // CX = PW - CW
+ //Endif
+ if (cx > 0)
+ cx = 0;
+ else if (cx < (pw - cw) && cw > pw)
+ cx = pw - cw;
+
+ //If CY > 0 Then
+ // CY = 0
+ //Else If CY < (PH - CH) And If CH > PH Then
+ // CY = PH - CH
+ //Endif
+ if (cy > 0)
+ cy = 0;
+ else if (cy < (ph - ch) && ch > ph)
+ cy = ph - ch;
+
+ //If $hHBar.Value = - CX And If $hVBar.Value = - CY Then Return True
+ //Scroll(- CX, - CY)
+ elt.scrollLeft = - cx;
+ elt.scrollTop = - cy;
+ },*/
+
window:
{
zIndex: 0,
@@ -1026,6 +1126,12 @@ gw = {
}
if (x != sw.scrollLeft || y != sw.scrollTop)
gw.update(id, '#scroll', [sw.scrollLeft, sw.scrollTop]);
+ },
+
+ ensureVisible: function(id, row)
+ {
+ var sw = $(id).firstChild;
+ gw.table.scroll(id, sw.scrollLeft, $(id + ':' + row).offsetTop - sw.clientHeight / 2);
}
},
@@ -1162,7 +1268,7 @@ gw = {
xhr.send();
},
onSelect: function(e, term, item) {
- gw.update(id, 'text', $(id).value);
+ gw.textbox.setText(id, gw.textbox.getText(id));
}
});
},
@@ -1171,8 +1277,14 @@ gw = {
{
onactivate: function(id, e)
{
+ gw.log('textbox.onactivate');
if (e.keyCode == 13)
- setTimeout(function() { gw.raise(id, 'activate'); }, 50);
+ setTimeout(function() { gw.raise(id, 'activate', [], false); }, 50);
+ },
+
+ getText: function(id)
+ {
+ return $(id + ':entry').value;
},
setText: function(id, text)
@@ -1188,7 +1300,7 @@ gw = {
{
gw.textbox.setText(id, '');
gw.setFocus(id);
- gw.raise(id, 'activate');
+ gw.raise(id, 'activate', [], false);
}
}
}