Skip to content

Commit b65d683

Browse files
committed
Added SciterAPIHost.UpdateElement
1 parent 0130ea3 commit b65d683

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

Examples/DeveloperExample/Program.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
using EmptyFlow.SciterAPI;
33
using EmptyFlow.SciterAPI.Client;
4+
using EmptyFlow.SciterAPI.Client.DeveloperConsole;
45
using EmptyFlow.SciterAPI.Client.Models;
56
using EmptyFlow.SciterAPI.Client.PseudoSom;
67
using EmptyFlow.SciterAPI.Enums;
@@ -16,24 +17,25 @@
1617
//host.Callbacks.AddAttachBehaviourFactory ( "testbehaviour", ( element ) => new TestGraphicsEventHandler ( element, host ) );
1718
host.Callbacks.AddAttachBehaviourFactory ( "psom", ( element ) => new PseudoSomHandler ( element, host ) );
1819
host.EnableDebugMode ();
19-
host.EnableFeatures ( SciterRuntimeFeatures.ALLOW_SOCKET_IO );
20+
host.EnableFeatures ( SciterRuntimeFeatures.ALLOW_SOCKET_IO);
2021
host.CreateWindow ( asMain: true, debugOutput: true );
2122
host.AddWindowEventHandler ( new MyWindowEventHandler ( host.MainWindow, host ) );
2223
host.LoadFile ( path );
2324
host.Process ();
2425

2526

26-
public class MyWindowEventHandler : WindowEventHandler {
27+
public class MyWindowEventHandler : ElementEventHandler {
28+
29+
DeveloperConsole _devConsole;
2730

2831
public MyWindowEventHandler ( nint window, SciterAPIHost host ) : base ( window, host ) {
32+
_devConsole = new DeveloperConsole ( host, host.MainWindow );
2933
}
3034

3135
public override void BehaviourEvent ( BehaviourEvents cmd, nint heTarget, nint he, nint reason, SciterValue data, string name ) {
3236
if ( cmd == BehaviourEvents.DOCUMENT_READY ) {
33-
var value = Host.GetWindowParent ( Host.MainWindow );
34-
if ( value == 0 ) {
3537

36-
}
38+
//var result = Host.ExecuteWindowFunction ( Host.MainWindow, "testFolder", [], out var res );// ShowWindowSelectFolderDialog ( Host.MainWindow, "Test", "" );
3739
}
3840
}
3941

@@ -43,6 +45,8 @@ public class TestModel : IPseudoSomModel {
4345

4446
private readonly SciterAPIHost m_host;
4547

48+
private string _unique = "";
49+
4650
public TestModel ( SciterAPIHost host ) {
4751
m_host = host;
4852
}
@@ -61,6 +65,8 @@ public HashSet<string> GetMethods () {
6165

6266
public int Counter { get; set; } = 5;
6367

68+
public string Unique => _unique;
69+
6470
public SciterValue GetPropetyValue ( string name ) {
6571
return name switch {
6672
"counter" => m_host.CreateValue ( Counter ),
@@ -76,6 +82,10 @@ public bool SetPropetyValue ( SciterValue value, string name ) {
7682

7783
return false;
7884
}
85+
86+
public void SetUnique ( string unique ) {
87+
_unique = unique;
88+
}
7989
}
8090

8191
public class PseudoSomHandler : ElementEventHandler {

src/EmptyFlow.SciterAPI/Client/HostElementAPI.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,12 @@ public string GetElementStyleProperty ( IntPtr element, string name ) {
166166
return valueReceiver.Value ();
167167
}
168168

169-
public void SetElementStyleProperty ( IntPtr element, string name, string value ) {
169+
public void SetElementStyleProperty ( nint element, string name, string value ) {
170170
m_basicApi.SciterSetStyleAttribute ( element, name, value );
171171
}
172172

173+
public void UpdateElement ( nint element, bool forceRender ) => m_basicApi.SciterUpdateElement ( element, forceRender );
174+
173175
}
174176

175177
}

src/EmptyFlow.SciterAPI/EmptyFlow.SciterAPI.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
SciterEventHandler.SetReturnState for some handlers it required to change return state
2727
WindowEventHandler now obsolete, it redundant class please use SciterEventHandler instead in all cases
2828
SciterAPIHost.AddWindowEventHandler added argument behaviours for change tracked behaviours
29+
SciterAPIHost.UpdateElement for (re)render element
2930
Fixed issue in showing different from main window
3031
</PackageReleaseNotes>
3132
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

0 commit comments

Comments
 (0)