Forum Replies Created
-
AuthorPosts
-
July 25, 2024 at 03:04 in reply to: “Invalid Variant Operation” Error When Using Parameters in Detail Query #57657
TomYU
ParticipantWhich line of code specifically caused the problem?
TomYU
Participant这是我以前写的,参考下。
TomYU
ParticipantClose Range check
TomYU
Participant…..
TomYU
ParticipantThis problem does exist and we look forward to resolving it as soon as possible. Additionally, I have encountered issues with calling the Activate method.
When switching to Activate, Activate=True and the schedule is not executed.TomYU
ParticipantkbmMW Version: 5.23.00
January 11, 2024 at 02:46 in reply to: When will the new version of kbmMW be released for Delphi 12? #57404TomYU
ParticipantLet’s see if there’s any latest news, unfortunately it’s still not there.
TomYU
ParticipantThis content is meaningless. Kbmmw is right.
TomYU
ParticipantSorry,this is error.
Define in unit System:
{$IFDEF POSIX}
TThreadID = NativeUInt;
{$ENDIF}Help file:
Defines a platform-dependent unsigned integer.
NativeUInt represents a subset of the natural numbers. The range of NativeUInt depends on the current platform. On 32-bit platforms, NativeUInt is equivalent to the Cardinal type. On 64-bit platforms, NativeUInt is equivalent to the UInt64 type.
The size of NativeUInt is equivalent to the size of the pointer on the current platform.
function kbmMWGetCurrentThreadID:TkbmNativeUInt;
should change to :
function kbmMWGetCurrentThreadID:TThreadID ;TomYU
Participantit’s work fine.
TomYU
Participant……
TomYU
Participanthow to test?
Is Delphi 11 or Delphi 11.1?
TomYU
ParticipantI’m not sure. I just want to test FLock.BeginWrite work as expected?
TomYU
ParticipantDefault compilation variables used:
{$DEFINE KBMMW_SUPPORT_FASTMRWSLOCK} // If to use native very fast Multiple Reader Exclusive Writer lock.TomYU
ParticipantThe pause method does not work as expected on the Android platform:
procedure TkbmMWCustomThread.Pause;
TomYU
ParticipantAs a new development, I found that the code implemented in this way can execute normally on android platform.
procedure TForm1.Button2Click(Sender: TObject);
begin
rs:=TkbmMWPooledDatasetRefreshScheduler.Create(Self);
rs.StopScheduling; //not frozen when TkbmMWPooledDatasetRefreshScheduler.Owner<>nil.
rs.Free;
rs:=nil;
end;
TomYU
ParticipantWhen the application is closed, kbmMWClientConnectionPool1 will be released.
and kbmMWClientConnectionPool1 will execute the following methods:
FRefreshScheduler. StopScheduling;
On the Android platform, this line of code is frozen and will not continue.So the application can’t exit normally!
fixed code:
procedure TkbmMWPooledDatasetRefreshScheduler.StopScheduling;
begin
if FThread.IsStarted then//add by Tom YU
FThread.Pause;
end;I don’t know if this correction is correct, but my application can be closed normally.
best regards
Tom YU.
TomYU
ParticipantI found the cause of this problem, but I don’t know how to modify the code.
Problems caused by kbmMWGetCurrentThreadID function on Android platform.
This function generates an exception when the boundary check compilation option is turned on.
I recorded more details here:
TomYU
Participanthi,
I did this just to redisplay the problem.
When the application is closed, because this component cannot be released normally, the application cannot exit normally. When the application is restarted, the application is stuck.
This is a problem on the Android platform.best regards
Tom YU.
TomYU
ParticipantHas this problem been solved?
TomYU
ParticipantA ClientQuery has F1,F2,F3 fields, F1 is primary key,when i modify F2, I want to generate SQL like this: update testtable set (f1,f2) values (‘aaa’,’bbb’) where f1=xxx.
May 17, 2021 at 04:39 in reply to: SmartBind have xxxxx:DataSet not in edit mode error message. #55773TomYU
Participanthi, kim
In fact, this problem has existed since 5.10.10, and we look forward to official corrections.
best regards
Tom YU.
May 17, 2021 at 01:32 in reply to: SmartBind have xxxxx:DataSet not in edit mode error message. #55771TomYU
Participantfixed code:
procedure TkbmMWBindingDataSourceNavigator.SetValue(const AName:string; const AValue:TValue);
var
fld:TField;
begin
if IsValid then
begin
fld:=FDataSource.Dataset.FindField(AName);
if fld<>nil then
begin
if not (FDataSource.Dataset.State in [dsEdit,dsInsert]) then //+++++
FDataSource.DataSet.Edit;//+++++
fld.AsVariant:=TkbmMWRTTI.ConvertValue2Variant(AValue,nil);
FDataSource.DataSet.Post;//+++++
end;
end;
end;TomYU
Participantthanks!
TomYU
Participantfixed code:
class function TkbmMWPlatformMarshal.Memory2Int16(const AMemory:PByte; const ALittleEndian:boolean):smallint; type TShortBytes = packed record case integer of 1: (short: smallint); 2: (b:array[1..2] of byte); end; PShortBytes = ^TShortBytes; PShort=^smallint; var t:TShortBytes; begin {$IFDEF KBMMW_BIG_ENDIAN} if ALittleEndian then {$ELSE} if not ALittleEndian then {$ENDIF} begin t.b[1]:=PShortBytes(AMemory).b[2]; t.b[2]:=PShortBytes(AMemory).b[1]; Result:=t.short; end else Result:=PShort(AMemory)^; end;TomYU
Participanthi,
kbmMW 5.15 fixed!
thanks!
best regards.
Tom yu
TomYU
ParticipantCan it display the file name requested by the client?
TomYU
ParticipantFMX ListView only displays the content of the first bound field, the others are not displayed.
TomYU
Participantprocedure TForm3.Button1Click(Sender: TObject); begin FBindings := TkbmMWBindings.Create; FBindings.Bind(DisplayDataSet, 'f1', ListView1, '#Text1'); // error. FBindings.Bind(DisplayDataSet, 'f2', ListView1, '#Text2'); FBindings.Bind(DisplaydataSet, '@', ListView1, '@', [mwboTwoWay]); FBindings.UpdateEvent.Activate(False); FBindings.Clear; //An error occurred end;
Writing the code like this reproduced this error.
TomYU
ParticipantThis problem is real in my actual project, for this reason I cannot upgrade to kbmMW 5.14.
TomYU
Participantprocedure TListDialogFrame.PrepareView; begin if DisplayDataSet <> nil then begin ListViewSearchBox(ListView1).Text:=''; FBindings.Clear;//******************* if KeyFieldName <> '' then FBindings.Bind(DisplayDataSet, KeyFieldName, ListView1, ''); FBindings.Bind(DisplayDataSet,DisplayFieldName,ListView1,'#Caption'); FBindings.Bind(DisplaydataSet,'@',ListView1,'@',[mwboTwoWay]); //双向绑定.位置同步. FBindings.Update; FBindings.UpdateEvent.Activate(True); end else begin FBindings.Clear;//***************** FillListFromDisplayStringList; end; end;TomYU
ParticipantBecause of this issue, I cannot upgrade to kbmMW 5.14!
TomYU
Participantwhen will release an update of kbmMW?
TomYU
ParticipantWhat compile error message is displayed?
Is it “[DCC Error] kbmMWGlobal.pas(3560): E2003 Undeclared identifier: ‘TkbmMWStringList'”?
I also encountered a similar problem.
-
This reply was modified 5 years, 11 months ago by
TomYU.
TomYU
Participantki,kim
delete this topic.
TomYU
ParticipantI had to change Queue to Synchronize to ensure that my application can run normally.
TomYU
ParticipantHi,
I tried and still did not solve the problem, I sent an email to you, pay attention to check.
best regards
Tom YU.
TomYU
Participanthi,
I’m sorry,I made a mistake!
best regards
Tom YU.
TomYU
Participanthi,
I found set kbmMWTCPIPIndyClientTransport1.VerifyTransfer and kbmMWTCPIPIndyServerTransport1.VerifyTransfer =True, Client can connect server.
if set VerifyTransfer=False for server and client, Client can’t connect server.
best regards
TomYU.
November 7, 2020 at 05:40 in reply to: Issue of kbmMWClientQuery.AutoFieldDefsOnOpen property. #55204TomYU
Participanthi,kim
5.13 fixed! Thank you.
Best regards
TomYU.
TomYU
Participanthi,kim
5.13 not fixed!
Best regards
TomYU.
TomYU
Participanthi,kim
5.13 fixed!
Thank you.
Best regards
TomYU.
TomYU
Participanthi,kim
5.13 fixed!
thank you!
best regards
TomYU
TomYU
ParticipantCode written like the following will not trigger WhenException.
Scheduler.Run(Task1)
.WhenException(procedure(const AException:Exception)
begin
ShowMessage(AException.Message);
end)
.Activate;TomYU
Participanthi,
Thank you for your reply and agree with you.
If this method is added to kbmMWClientQuery, it will let me not use the helper class.
best regards.
Tom yu.
TomYU
ParticipantThis is the helper class I wrote to solve the above problem:
function TkbmMWClientQueryHelper.IsModified: Boolean;
var
i: TkbmNativeInt;
j: TkbmNativeInt;
pRec, pOrigRec, pOldRec: PkbmRecord;
aRecords: TkbmList;
st: TUpdateStatus;
aOldV, aNewV: Variant;
begin
if Self.State in [dsInsert, dsEdit] then
Self.Post;
Result := False;
with Self do
begin
aRecords := Common.Records;
for i := 0 to aRecords.Count – 1 do
begin
pRec := PkbmRecord(aRecords.Items[i]);
if pRec = nil then
begin
Continue;
end;
// Find oldest version.
pOrigRec := pRec;
while pOrigRec^.PrevRecordVersion <> nil do
begin
pOrigRec := pOrigRec^.PrevRecordVersion;
end;// Check what status to react on.
if pRec^.UpdateStatus = usDeleted then
begin
// Dont resolve inserts that were deleted again.
if pOrigRec^.UpdateStatus = usInserted then
st := usUnmodified
else
st := usDeleted;
end
else if pOrigRec^.UpdateStatus = usInserted then
st := usInserted
else
st := pRec^.UpdateStatus;
pOldRec := OverrideActiveRecordBuffer;
try
if st = usModified then
begin
OverrideActiveRecordBuffer := pRec; // 指向修改后的数据
for j := 0 to FieldCount – 1 do
begin
OverrideActiveRecordBuffer := pRec; // 指向修改后的数据
aNewV := FieldByName(Fields[j].FieldName).Value;
OverrideActiveRecordBuffer := pOrigRec; // 指向修改前的数据
aOldV := FieldByName(Fields[j].FieldName).Value;
if aNewV <> aOldV then
begin
Result := True;
Break;
end;
end;
end
else if st = usInserted then
begin
Result := True;
end
else if st = usDeleted then
begin
Result := True;
end
else if pRec.UpdateStatus = usUnmodified then
beginend;
finally
OverrideActiveRecordBuffer := pOldRec;
end;if Result then
Break;
end;
end;
end;TomYU
ParticipantFor such a complicated SQL, it is better to write a method on the server side.
TomYU
ParticipantCurrently I only use listView binding with ClientQuery.
TomYU
ParticipantHi,
Thanks!
5.12 fixed is OK!TomYU
ParticipantI bind the keyfield value to a Text object in ListviewItem,
Now I call the DataSet.Locate method to synchronize the current position of the Dataset.TomYU
ParticipantThis problem affects the TkbmMWBindings.Update method.
The TkbmMWBindings.Update method will enter an infinite loop when the UpdateNonSync method generates an exception.TomYU
ParticipantDo you call the Stop method in the thread executed by the Scheduler?
If so, that is the reason.
TomYU
ParticipantAfter using mwafoNevera or mwafoOncer, I do not need to rebind, but when ClientQuery is opened, Listview and data set are often displayed out of sync, even though I call the Refresh method.
This forced me to change back to the original way.TomYU
ParticipantI have some questions about smartbind:
1.Smarbind does not work properly on the Android platform, but works normally on Windows. When ClientQuery.AutoFieldDefsOnOpen = mwafoOnce.
I think mwafoOnce has bug on android platform.
An error message : the field does not have a dataset.2.I had to call Refresh twice for Listview to display the contents of the dataset correctly.
qOrderItem is a TkbmMWClientQuery and qOrderItem .AutoFieldDefsOnOpen =mwafoNeverprocedure TForm1.BindOrderItem;
begin
qOrderItem .AutoFieldDefsOnOpen :=mwafoNever;
if NavigatorOrderItem=nil then
begin
FBindOrderItem.Bind(qOrderItem, ‘FGoodsCode’, ListView1, ‘#fgoodscode’);
… NavigatorOrderItem:=FBindOrderItem.Bind(qOrderItem, ‘@’, ListView1, ‘@’, [mwboTwoWay]);
end;
NavigatorOrderItem.Navigator.Refresh;
NavigatorOrderItem.Navigator.Refresh;//+++++++++++++end;
3.In the process of repeatedly opening the dataset when clientquery .AutoFieldDefsOnOpen :=mwafoNever, occasionally an error message is generated: the field does not have a dataset. This is caused when smartbind calls the Update method.
TomYU
Participanthi,
“In addition, when the Listview is bound to the clientquery, my users can feel the efficiency is very low on the android platform, Is there a way to improve the efficiency?”
This problem was caused by rebinding.
I created a field for ClientQuery during the design period and bound it once during the run time to solve the problem of slow display.best regards
Tom yu.TomYU
Participanthi,
This is definitely good news for me.
I have used smartbind in the actual project. If I can see the improvement of the above problem as soon as possible, it is a very grateful event for me.
I have already felt the perfection of smartbind. Smartbind is a technology that must be used in the development projects. I look forward to smartbind being more perfect.
In order to bind the reopened clientquery, I have to write a lot of code because my clientquery is on the datamodule and the binding object is on the form. In the end, it looks like the form and datamodule Still tightly coupled together.
In addition, when the Listview is bound to the clientquery, my users can feel the efficiency is very low on the android platform, Is there a way to improve the efficiency?
best regards
Tom yu.TomYU
ParticipantI bind a clientquery, and then when I reopen the clientquery, I must clear the binding before opening, and then rebind after opening.
How can smartbind better support data reopening? Once bound, Smartbind can adapt to the reopening of the clientquery.
TomYU
ParticipantHow do you modify it?
-
This reply was modified 5 years, 11 months ago by
-
AuthorPosts
