zhyhero
-
Posts
131 -
Joined
-
Last visited
-
Days Won
5
Content Type
Profiles
Forums
Events
Posts posted by zhyhero
-
-
The world is "Tree" .
Run unigui app, open url in browser, and the developer-tool will tell you what is inside it.
Type and run “console.log(this)” in developer-tool.
(This pic shows how current session objects are organized like a tree inside the browser vm , and "this" is a "Window" type object. )
Every object may have a name ,like O6A,O10....... and MainForm.
When you include an outside js file,it's content will append to the "Tree".
Example ,we define a function in file "jsfunc.js",
function ___js_func_1(){
alert("call js_function");
}
and add "/files/jsfunc.js" to servermodule.customfiles.
When uniapp initialized, the function "___js_func_1" will append to the object tree (this is "Window").
Or we put an TUniHTMLFrame on a UniForm, set HTML property with:
<head>
<script>
function ___my_func_good(){ alert('good'); } // function append to "Window"var ___mytools={}; // object append to "Window"
___mytools.good=function (){ alert('good'); } //function append to "Window".___mytools</script>
</head>
<body>
hello<br>
<input type="button" value="click good" onclick="___my_func_good()"></input>
</body>
At runtime, "___my_func_good" and "___mytools" will append to the tree (this is "Window"), like pic shows.
Usually,we just simple call "this.___js_func_1()", "this.___myfunc_good()" and "this.___mytools.good()".
Unisession.AddJs('this.___js_func_1();');
You can add any new child object(or function) to any object on the tree, so it is important to make sure what is "this".
If you dynamic create js objects or functions in runtime , you may consider how to organize them on the "Tree"
-
Temporary :
procedure TUniFrame1.UniDBGrid1AfterLoad(Sender: TUniCustomDBGrid);
begin
....JSInterface.JSCall('setStyle', [JSInterface.JSObject(['top', '-2px'])], UniComboBox1.JSControl);
end; -
Thank you.
But still have problem when in a frame .
source code : 20230121_UniDBGrid_Combobox_Frame.zip
-
I add an UniCombobox to UniDBgrid's HeadTitle area,
self.UniDBGrid_Sample.JSInterface.JSCall('header.insert', [1, self.UniComboBox1.JSControl]);
but height of headertitle area become more bigger,
so i reset the height of headertitle area to default,
self.UniDBGrid_Sample.JSInterface.JSCall('header.setHeight', [HeaderHeight]);
now , the position of titletext and unicombobox become strange, how to fix this?
source code 20230120_UniDBGrid_Combobox.zip
-
How about check "InTransaction" ?
if FDConnection.InTransaction then
begin
ShowmessageN('Last Transaction is not finish');
Exit;
end;FDConnection.StartTransaction;
try
...
FDConnection.Commit;
except
FDConnection.Rollback;
end;
-
What place (or unit) is your " FDConnection" created ?
-
Synchronous and asynchronous.
A lot of asynchronous with web app.
-
On 10/11/2022 at 1:36 PM, Denton said:
Hi
Here.. if u remove the OnCellClick event the bug wont show...
I am not sure this is helpful , something (procedure or function) delayed untill OnCellClick.
So i changed your source code.
type
TMainForm = class(TUniForm)
UniDBGrid1: TUniDBGrid;
UniDBNavigator1: TUniDBNavigator;
DataSource1: TDataSource;
procedure UniFormCreate(Sender: TObject);
procedure UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer);
procedure UniDBGrid1CellClick(Column: TUniDBGridColumn);
private
{ Private declarations }
DeleteJobReady: boolean;
public
{ Public declarations }
end;function MainForm: TMainForm;
implementation
{$R *.dfm}
uses
uniGUIVars, MainModule, uniGUIApplication, StrUtils;function MainForm: TMainForm;
begin
Result := TMainForm(UniMainModule.GetFormInstance(TMainForm));
end;procedure TMainForm.UniDBGrid1CellClick(Column: TUniDBGridColumn);
begin
if DeleteJobReady then
begin
UniMainModule.ClientDataSet1.Delete;
DeleteJobReady := false;
end;
end;procedure TMainForm.UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer);
begin
DeleteJobReady := true;
end;procedure TMainForm.UniFormCreate(Sender: TObject);
var
I: Integer;
begin
DeleteJobReady := false;
with UniMainModule.ClientDataSet1 do
begin
for I := 1 to 100 do
begin
Append;
FieldByName('EmpNo').AsInteger := I;
FieldByName('Lastname').AsString := Char(65 + Random(28));
FieldByName('Firstname').AsString := Char(65 + Random(28));FieldByName('shift').AsBoolean := Random(2) = 1;
FieldByName('BoolInt').AsInteger := Random(2);
FieldByName('Boolstring').AsString := IfThen(Random(2) = 0, 'set', 'unset');
Post;
end;
First;
end;
end; -
0. Loading error
Theme: uni_windows11_triton
Messages:
GET http://localhost:8077/unipackages-7.5.1-1.70/themes/ext-theme-uni_windows11_triton/resources/fonts/OpenSans-Light.ttf net::ERR_ABORTED 404 (Not Found)
GET http://localhost:8077/unipackages-7.5.1-1.70/themes/ext-theme-uni_windows11_triton/resources/fonts/OpenSans-Regular.ttf net::ERR_ABORTED 404 (Not Found)1.CheckBox Icon lost
Theme: uni_windows11, uni_windows11_triton
cls-class: x-grid-checkcolumn-checked...
Condition: ServerModule.IncludeFontAwesome4=false;
2.ActionColumn row Icon(Button) Lost
Condition: Set Column.Title.Caption With some html tag like "<i></i>"
How to fix this ?????👀
BTW, ActionColumn.Button.IconCls='fa fa-circle'
Here is Demo source code Fontawesome_Test2_20221009.zip
-
After some searching and reading in forum, I find this post.
I have changed source codes according to this post. Now codes are working.
It is hard to study JS(Extjs) code for me.
Here is source code.
-
-
You can try Event
-
-
-
These days , I was trying to implement a special nested json data viewer in unihtmlframe .
After more and more searching, find JsViews/JsRender from https://www.jsviews.com , it can make my jobs easy.
I put my example souce code on fourm to share.
- 1
-
try UniStringgrid1->clientevent->afterrender
function afterrender(sender, eOpts)
{
sender.view.el.addListener('scroll',function(e,t){
MainForm.UniStringGrid2.view.el.dom.scrollTop=t.scrollTop;
MainForm.UniStringGrid2.view.el.dom.scrollLeft=t.scrollLeft;
});
} -
17 minutes ago, Sherzod said:
Hello,
Because you are assigning a new event every time.
Thank you.
I add Script " $(document).off("click",".bt1"); ", now working right .
-
1.click "Run" button
2.click "Hello" button
3.click "Run" button again
4.click "Hello" button
...
Then we can see , strings "hello" are input to memo more and more and more.
scripts execute more times.
Any idea ?
-
Edge Browser - >DevTools
GET http://localhost:8077/uni-1.90.0.1563/css/uni-xtheme.css net::ERR_ABORTED 404 (Not Found)
-
TMyDynamicForm(MyFrame1.Owner).Close --or free
-
On 1/17/2022 at 8:45 AM, mikromundo said:
Try use UTF8.
The test was successed running by VCL Application mode, no need change souce file to UTF8.
And if there has only one AureliusDatasetXXXXXX object (TSomeField type, Not the entity class) declare with none english characters name ,it may successed running by Unigui Application mode.
look call statck ==> ObjectTextToBinary()->.............->TParser.TokenString-> TEncoding.GetString()
I guess there have some problem during "cast .dfm file or it's TStream object" process.
-
-
Thx,I will try.
-
As normal ,control's width include control's filedlabelwidth.
But with FieldContainer, they are separate, and 5px diff.
So ,it is uncomfortable between design and result.
uniURLFrame: call function in html page or external JS files.
in General
Posted
Sorry for missed the point.
In you testcase,
#1'.iframe.contentWindow.myAlert();' => UniURLFrame1.JSName+'.iframe.contentWindow.myAlert();'
UniURLFrame1.JSName => O5E or other ...
O5E is on the Tree.
I guess #1 just a placeholder, it will replace by some jsname on runtime.
try
UniURLFrame1.JSInterface.JSCode('O5E.iframe.contentWindow.myAlert();');
unisession.addjs('O5E.iframe.contentWindow.myAlert();');
And in you index.html file
<script>
function myAlert() {
alert('peek-a-boo I see you');
console.log('out -> ',this); // this will be O5E.iframe.contentWindow
};
</script>
top => O5E's parent ,root of the Tree.