[INTERPRETER]
* NEW: _ready() is new special method that is called when an object construction is completly finished. [COMPILER] * NEW: Remove the call to _load() method in form constructors. [GB.WEB.FORM] * BUG: WebExpander: Remove a debugging message. * NEW: WebForm.Debug is a new static property that, if set, dumps all exchanges between the server and the client in the browser console. * NEW: Use the new _ready special method. * NEW: WebLabel: Add the Border property. * NEW: WebLabel: Alignment is a new property that defines the label horizontal alignment. * NEW: A few changes in default style sheet. git-svn-id: svn://localhost/gambas/trunk@7541 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
7b734661d7
commit
a6f458e05c
16 changed files with 174 additions and 73 deletions
|
@ -769,6 +769,10 @@ _DefaultEvent
|
|||
C
|
||||
s
|
||||
"Open"
|
||||
Debug
|
||||
P
|
||||
b
|
||||
|
||||
_InExec
|
||||
V
|
||||
i
|
||||
|
@ -825,7 +829,7 @@ _AddJavascript
|
|||
M
|
||||
|
||||
(sStr)s
|
||||
_load
|
||||
_ready
|
||||
m
|
||||
|
||||
|
||||
|
@ -928,7 +932,7 @@ C
|
|||
_Properties
|
||||
C
|
||||
s
|
||||
"*,Text,Border"
|
||||
"*,Text,Alignment,Border"
|
||||
_DrawWith
|
||||
C
|
||||
s
|
||||
|
@ -941,10 +945,18 @@ Text
|
|||
p
|
||||
s
|
||||
|
||||
Alignment
|
||||
p
|
||||
i
|
||||
|
||||
_Render
|
||||
m
|
||||
|
||||
|
||||
_RenderStyleSheet
|
||||
m
|
||||
|
||||
|
||||
#WebMenu
|
||||
WebContainer
|
||||
C
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 3.8.90
|
||||
Startup=Webform3
|
||||
Startup=Webform2
|
||||
UseHttpServer=1
|
||||
Version=3.8.90
|
||||
VersionFile=1
|
||||
|
|
|
@ -8,3 +8,18 @@ Public Sub Main()
|
|||
|
||||
End
|
||||
|
||||
Public Sub DumpSession()
|
||||
|
||||
Dim sKey As String
|
||||
|
||||
Debug Session.Id
|
||||
|
||||
If Session.Id Then
|
||||
|
||||
For Each sKey In Session.Keys
|
||||
Debug sKey; ": "; JSON.Encode(Session[sKey])
|
||||
Next
|
||||
|
||||
Endif
|
||||
|
||||
End
|
||||
|
|
|
@ -12,14 +12,13 @@ Public Sub _new()
|
|||
Next
|
||||
'WebTable1.Columns[3].Expand = True
|
||||
|
||||
WebTable1.Count = 250
|
||||
WebTable1.Select(2, 3)
|
||||
|
||||
End
|
||||
|
||||
Public Sub WebForm_Open()
|
||||
|
||||
WebTable1.Count = 250
|
||||
WebTable1.Select(2, 3)
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
|
|
@ -91,7 +91,6 @@ End
|
|||
|
||||
Private Sub Border_Write(Value As Boolean)
|
||||
|
||||
Debug Value
|
||||
$bBorder = Value
|
||||
Me._SetProperty("Border", Value)
|
||||
|
||||
|
|
|
@ -10,9 +10,12 @@ Public Const _HiddenControls As String = "WebControl,WebForm,WebWindow,Timer"
|
|||
Public Const _Properties As String = "*,Title,Resizable"
|
||||
Public Const _DefaultEvent As String = "Open"
|
||||
|
||||
Static Property Debug As Boolean
|
||||
|
||||
Static Public _InExec As Integer
|
||||
Static Public _Current As WebForm
|
||||
|
||||
Static Private $bDebug As Boolean
|
||||
Static Private $aJavascript As New String[]
|
||||
|
||||
Event Open
|
||||
|
@ -103,6 +106,7 @@ Static Public Sub Main()
|
|||
Endif
|
||||
|
||||
_Current = hForm
|
||||
|
||||
If sPath = "x" Then
|
||||
hForm._Exec(JSON.Decode(Request["c"]))
|
||||
Else
|
||||
|
@ -126,7 +130,7 @@ Static Public Sub _AddJavascript(sStr As String)
|
|||
|
||||
End
|
||||
|
||||
Public Sub _load()
|
||||
Public Sub _ready()
|
||||
|
||||
Me._InitProperties
|
||||
_Loaded = True
|
||||
|
@ -442,3 +446,16 @@ End
|
|||
' If hWindow Then hWindow.Centered = True
|
||||
'
|
||||
' End
|
||||
|
||||
Static Private Function Debug_Read() As Boolean
|
||||
|
||||
Return $bDebug
|
||||
|
||||
End
|
||||
|
||||
Static Private Sub Debug_Write(Value As Boolean)
|
||||
|
||||
$bDebug = Value
|
||||
_AddJavascript("gw.debug = " & JS(Value))
|
||||
|
||||
End
|
||||
|
|
|
@ -3,13 +3,15 @@
|
|||
Export
|
||||
Inherits WebControl
|
||||
|
||||
Public Const _Properties As String = "*,Text,Border"
|
||||
Public Const _Properties As String = "*,Text,Alignment,Border"
|
||||
Public Const _DrawWith As String = "Label"
|
||||
Public Const _DefaultSize As String = "24,4"
|
||||
|
||||
Property Text As String
|
||||
Property Alignment As Integer
|
||||
|
||||
Private $sText As String
|
||||
Private $iAlign As Integer
|
||||
|
||||
|
||||
Private Function Text_Read() As String
|
||||
|
@ -30,3 +32,45 @@ Public Sub _Render()
|
|||
Print Replace(Html($sText), "\n", "<br>");
|
||||
|
||||
End
|
||||
|
||||
Public Sub _RenderStyleSheet()
|
||||
|
||||
If $iAlign Then
|
||||
|
||||
Me._StartStyleSheet
|
||||
|
||||
Super._RenderStyleSheet()
|
||||
|
||||
Select Case $iAlign
|
||||
Case Align.Left
|
||||
Me._AddStyleSheet("justify-content:flex-start;")
|
||||
Case Align.Right
|
||||
Me._AddStyleSheet("justify-content:flex-end;")
|
||||
Case Align.Center
|
||||
Me._AddStyleSheet("justify-content:center;")
|
||||
End Select
|
||||
|
||||
Me._EndStyleSheet
|
||||
|
||||
Else
|
||||
|
||||
Super._RenderStyleSheet
|
||||
|
||||
Endif
|
||||
|
||||
|
||||
End
|
||||
|
||||
|
||||
Private Function Alignment_Read() As Integer
|
||||
|
||||
Return $iAlign
|
||||
|
||||
End
|
||||
|
||||
Private Sub Alignment_Write(Value As Integer)
|
||||
|
||||
$iAlign = Value
|
||||
Me._SetProperty("Alignment", Value)
|
||||
|
||||
End
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Webform3
|
||||
Webform2
|
||||
|
||||
0
|
||||
0
|
||||
|
|
|
@ -34,13 +34,13 @@ P:first-child,UL:first-child,OL:first-child {
|
|||
.gw-button {
|
||||
padding: 0;
|
||||
font: inherit;
|
||||
padding: 0 0.25em;
|
||||
/*min-height: 1rem;*/
|
||||
}
|
||||
|
||||
.gw-button.gw-noborder {
|
||||
border: solid 1px transparent;
|
||||
background: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.gw-button.gw-noborder:hover {
|
||||
|
@ -476,12 +476,20 @@ P:first-child,UL:first-child,OL:first-child {
|
|||
vertical-align: top;
|
||||
}
|
||||
|
||||
.gw-table > DIV > TABLE > THEAD > TR > TH:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.gw-table > DIV > TABLE > TBODY > TR > TD {
|
||||
border-right: solid 1px #C0C0C0;
|
||||
padding: 0.25em;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.gw-table > DIV > TABLE > TBODY > TR > TD:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.gw-table > DIV > TABLE > TBODY > TR:last-child > TD {
|
||||
border-bottom: solid 1px #C0C0C0;
|
||||
}
|
||||
|
|
|
@ -8,11 +8,18 @@ gw = {
|
|||
timers: {},
|
||||
windows: [],
|
||||
form: '',
|
||||
debug: false,
|
||||
|
||||
log: function(msg)
|
||||
{
|
||||
if (gw.debug)
|
||||
console.log(msg);
|
||||
},
|
||||
|
||||
send: function(command)
|
||||
{
|
||||
var xhr = new XMLHttpRequest();
|
||||
console.log(command);
|
||||
gw.log(command);
|
||||
xhr.open('GET', $root + '/' + encodeURIComponent(gw.form) + '/x?c=' + encodeURIComponent(JSON.stringify(command)), true);
|
||||
xhr.onreadystatechange = function() {
|
||||
//console.log('state = ' + xhr.readyState + ' / status = ' + xhr.status);
|
||||
|
@ -24,7 +31,9 @@ gw = {
|
|||
else
|
||||
gw.selection = undefined;
|
||||
|
||||
console.log(xhr.responseText);
|
||||
if (gw.debug)
|
||||
console.log(xhr.responseText);
|
||||
|
||||
eval(xhr.responseText);
|
||||
|
||||
if (gw.active)
|
||||
|
@ -128,7 +137,7 @@ gw = {
|
|||
{
|
||||
document.addEventListener('mousemove', gw.window.onMove);
|
||||
document.addEventListener('mouseup', gw.window.onUp);
|
||||
console.log('document.addEventListener');
|
||||
gw.log('document.addEventListener');
|
||||
}
|
||||
|
||||
gw.windows.push(id);
|
||||
|
@ -179,7 +188,7 @@ gw = {
|
|||
|
||||
if (gw.windows.length == 0)
|
||||
{
|
||||
console.log('document.removeEventListener');
|
||||
gw.log('document.removeEventListener');
|
||||
document.removeEventListener('mousemove', gw.window.onMove);
|
||||
document.removeEventListener('mouseup', gw.window.onUp);
|
||||
}
|
||||
|
|
|
@ -497,3 +497,4 @@ Private Function Size_Read() As Long
|
|||
Return $iSize
|
||||
|
||||
End
|
||||
|
||||
|
|
|
@ -502,7 +502,7 @@ void FORM_do(char *source, bool ctrl_public)
|
|||
if (form_parent_level > 0)
|
||||
goto _ERROR;
|
||||
|
||||
FORM_print("\n Try Me._load()\n");
|
||||
//FORM_print("\n Try Me._load()\n");
|
||||
FORM_print("\nEnd\n\n");
|
||||
|
||||
// Create or delete the action file if needed
|
||||
|
|
|
@ -1356,6 +1356,7 @@ void CLASS_search_special(CLASS *class)
|
|||
class->special[SPEC_PROPERTY] = CLASS_get_symbol_index_kind(class, "_property", CD_METHOD, CD_STATIC_METHOD);
|
||||
class->special[SPEC_COMPARE] = CLASS_get_symbol_index_kind(class, "_compare", CD_METHOD, 0);
|
||||
class->special[SPEC_ATTACH] = CLASS_get_symbol_index_kind(class, "_attach", CD_METHOD, 0);
|
||||
class->special[SPEC_READY] = CLASS_get_symbol_index_kind(class, "_ready", CD_METHOD, 0);
|
||||
|
||||
sym = CLASS_get_symbol_index_kind(class, "_@_convert", CD_CONSTANT, 0);
|
||||
if (sym != NO_SYMBOL)
|
||||
|
|
|
@ -355,6 +355,7 @@ typedef
|
|||
SPEC_PROPERTY,
|
||||
SPEC_COMPARE,
|
||||
SPEC_ATTACH,
|
||||
SPEC_READY,
|
||||
MAX_SPEC = 11
|
||||
}
|
||||
CLASS_SPECIAL;
|
||||
|
|
|
@ -1852,22 +1852,13 @@ void *EXEC_create_object(CLASS *class, int np, char *event)
|
|||
OBJECT_lock(object, TRUE);
|
||||
EXEC_special_inheritance(SPEC_NEW, class, object, np, TRUE);
|
||||
OBJECT_lock(object, FALSE);
|
||||
|
||||
// SP--; /* class */
|
||||
//
|
||||
// SP->_object.class = class;
|
||||
// SP->_object.object = object;
|
||||
// SP++;
|
||||
EXEC_special(SPEC_READY, class, object, 0, TRUE);
|
||||
}
|
||||
CATCH
|
||||
{
|
||||
// _free() methods should not be called, but we must
|
||||
OBJECT_UNREF(object);
|
||||
PROPAGATE();
|
||||
// SP--; /* class */
|
||||
// SP->type = T_NULL;
|
||||
// SP++;
|
||||
// PROPAGATE();
|
||||
}
|
||||
END_TRY
|
||||
|
||||
|
@ -1953,6 +1944,7 @@ void EXEC_new(void)
|
|||
EVENT_leave_name(save);
|
||||
|
||||
SP--; /* class */
|
||||
EXEC_special(SPEC_READY, class, object, 0, TRUE);
|
||||
|
||||
SP->_object.class = class;
|
||||
SP->_object.object = object;
|
||||
|
|
|
@ -392,7 +392,7 @@ static void error_OBJECT_create(void)
|
|||
|
||||
void *OBJECT_create(CLASS *class, const char *name, void *parent, int nparam)
|
||||
{
|
||||
void *ob;
|
||||
void *object;
|
||||
void *save;
|
||||
char *save_name;
|
||||
|
||||
|
@ -406,17 +406,19 @@ void *OBJECT_create(CLASS *class, const char *name, void *parent, int nparam)
|
|||
ON_ERROR(error_OBJECT_create)
|
||||
{
|
||||
_object_name = EVENT_enter_name(name);
|
||||
_object = ob = OBJECT_new(class, name, parent);
|
||||
_object = object = OBJECT_new(class, name, parent);
|
||||
if (OBJECT_set_pointer)
|
||||
{
|
||||
*OBJECT_set_pointer = ob;
|
||||
OBJECT_ref(ob);
|
||||
*OBJECT_set_pointer = object;
|
||||
OBJECT_ref(object);
|
||||
OBJECT_set_pointer = NULL;
|
||||
}
|
||||
|
||||
OBJECT_lock(ob, TRUE);
|
||||
EXEC_special_inheritance(SPEC_NEW, class, ob, nparam, TRUE);
|
||||
OBJECT_lock(ob, FALSE);
|
||||
OBJECT_lock(object, TRUE);
|
||||
EXEC_special_inheritance(SPEC_NEW, class, object, nparam, TRUE);
|
||||
OBJECT_lock(object, FALSE);
|
||||
|
||||
EXEC_special(SPEC_READY, class, object, 0, TRUE);
|
||||
|
||||
error_OBJECT_create();
|
||||
}
|
||||
|
@ -425,7 +427,7 @@ void *OBJECT_create(CLASS *class, const char *name, void *parent, int nparam)
|
|||
_object = save;
|
||||
_object_name = save_name;
|
||||
|
||||
return ob;
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
|
@ -452,6 +454,7 @@ void *OBJECT_create_native(CLASS *class, VALUE *param)
|
|||
break;
|
||||
}
|
||||
|
||||
EXEC_special(SPEC_READY, OBJECT_class(object), object, 0, TRUE);
|
||||
OBJECT_UNREF_KEEP(object);
|
||||
return object;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue