-
Content Count
75 -
Joined
-
Last visited
Posts posted by toufik
-
-
good morning every one ..its work just fine in windows ,, and in android its doesn't execute the procedure called StartLogin10 after the user choses yes ,, nothing happen ....can someone help please thanks ...i have this code below :procedure TFrmLogin.SpeedButton5Click(Sender: TObject);var Reply : Integer;beginif (lst2.Items.Count <> 0) and (lst2.ItemIndex <> -1)thenbeginReply := 0;TDialogService.MessageDialog('you are gonna edit something ', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbYes], TMsgDlgBtn.mbYes,0,procedure(const AResult: TModalResult)beginReply := AResult;end);if Reply =mrYes thenStartLogin10 ;********************************************end else ShowMessage( 'you have cancel the operation');end elseShowMessage('chose something from the list'); -
I have to ask is this the proper way to do it though ?
-
43 minutes ago, Serge_G said:Hi,
Well, logic, yes.
Depending on the REST API server function.
On another side a TListview (livebinded) for only 10 records a VerticalScrollbox filled by code should be a good alternative,
IMO getting previous page and next page (30 records) during thread process should be better
thank you for taking time to reply .
-
good morning every one ^^...TListView Paging****is this look logic to you ?a mobile app + rest .I want to be able to get 10 record every time .so how about putting the last record i get every time and send it back to the server side to get 10 more record starting with it ,,,,and so on ...is this look ok to you thank you -
On 5/3/2021 at 5:38 AM, eivindbakkestuen said:First, do some debugging and find out if the record "disappears" on the server side (query, or in the JSON transformation), or on the client side (store raw JSON, review contents...).
thanks for taking time to reply i found that i did not add an array , tjsonarray , that fix it for me
-
hello every one can some one help convert Thorse procedure unit to Tdwserverevent thank you in advance the code on Thorse are:unit uServico;interfaceuses Horse, System.SysUtils, DataSet.Serialize;procedure Servico(App: THorse);procedure Get(Req: THorseRequest; Res: THorseResponse; Next: TProc);implementationuses dmPrincipal;procedure Get(Req: THorseRequest; Res: THorseResponse; Next: TProc);begintrytryDataModule1 := TDataModule1.Create(nil);DataModule1.FDQuery1.Close;if req.Params.Count > 0 thenbeginDataModule1.FDQuery1.FetchOptions.RecsSkip:= strtointdef(req.Params.Items['pagina'],1) * strtointdef(req.Params.Items['max'],1);DataModule1.FDQuery1.FetchOptions.RecsMax:= strtointdef(req.Params.Items['max'],1);end;DataModule1.FDQuery1.Open();Res.Send(DataModule1.FDQuery1.ToJSONArray.ToJSON);finallyRes.Status(200);FreeAndNil(DataModule1);end;excepton e: exception dobeginRes.Send(e.Message);Res.Status(400);end;end;end;procedure Servico(App: THorse);beginApp.Get('/saler/:pagina/:max', Get);end; -
hi every onecan some one help me with problemI'm using Delphi REST with server and client but when i tried to show data on the client side its show only one row for some reason,what did i do wrong ?
PS : I'm using Delphi roi and restdatawarethe video down show what I'm deal with ; any help will be very appreciated ^^ thank youon the client side i'm using this code
procedure listv;
varjsonObj : TJsonObject;
json, sucesso, erro,id_store ,nom_store, phone_saler: string;
begin
// FrmLogin.FloatAnimation2.Stop;
// FrmLogin.FloatAnimation3.Stop;
if FrmLogin.listvreq.Response.JSONValue = nil then
begin
// FrmLogin.ExibirCampos;
ShowMessage('خطأ في إنشاء الحساب (JSON غير صالح)');
exit;
end;try
json := FrmLogin.listvreq.Response.JSONValue.ToString;
jsonObj := TJSONObject.ParseJSONValue(TEncoding.UTF8.GetBytes(json), 0) as TJSONObject;sucesso := jsonObj.GetValue('sucesso').Value;
erro := jsonObj.GetValue('erro').Value;
id_store := jsonObj.GetValue('id_store').Value;
nom_store := jsonObj.GetValue('nom_store').Value;
if sucesso <> 'S' then
begin
// FrmLogin.ExibirCampos;
ShowMessage(erro);
exit;
end
else// showmessage('تم احضار بيانات: ' + id_store+nom_store);
// FrmLogin.ExibirCampos;///
// FrmLogin.ListView1.Items.Clear();
finally
jsonObj.DisposeOf;
end;end;
procedure listverr(Sender: TObject);
begin
if Assigned(Sender) and (Sender is Exception) then
begin
// FrmLogin.ExibirCampos;
showmessage(Exception(Sender).Message);
end;
end;procedure TFrmLogin.StartLogin2;
begin
TThread.CreateAnonymousThread(
procedure
var
Success: Boolean;
begin
try
RequestLogin.Execute;
Success := RequestLogin.Response.Status.Success;
except
Success := False;
end;
TThread.Queue(nil,
procedure
begin
AfterLogin2(Success);
end
);
end
).Start;
end;procedure TFrmLogin.AfterLogin2(Success: Boolean);
begin
if Success then
beginlistvreq.Params.Clear;
listvreq.AddParameter('type_store',ComboBox1.Selected.Text); /// ****
listvreq.ExecuteAsync(listv, true, true, listverr);
end
else
begin
showmessage (' عفوا ...! لايمكن الاتصال بالخادم حاليا يرجى المحاولة لاحقا')
end;
on server side :
procedure Tdm.DWEventsEventslistvReplyEvent(var Params: TDWParams;
var Result: string);
var
type_store, erro : string;
usuario : TUsuario;
json : TJsonObject;
begin
try
sleep(4000);
type_store := Params.ItemsString['type_store'].AsString;json := TJsonObject.Create;
usuario := TUsuario.Create(dm.conn);
usuario.type_store := type_store;if NOT usuario.listv(erro) then
begin
//{"sucesso": "N", "erro":"Usuلrio nمo informado", "codusuario":"0"}
json.AddPair('sucesso', 'N');
json.AddPair('erro', erro);
json.AddPair('id_store', '');
json.AddPair('nom_store', '');
end
else
begin
json.AddPair('sucesso', 'S');
json.AddPair('erro', '');
json.AddPair('id_store', usuario.id_store.ToString);
json.AddPair('nom_store', usuario.nom_store);
end;Result := json.ToString;
finally
json.DisposeOf;
usuario.DisposeOf;
end;and in class i add called unit usuario
function TUsuario.listv(out erro: string): Boolean;
var
qry : TFDQuery;begin
try
qry := TFDQuery.Create(nil);
qry.Connection := FConn;with qry do
begin
Active := false;
SQL.Clear;
SQL.Add('SELECT * from saler WHERE type_store = :any ');
ParamByName('any').Value := type_store;
Active := true;if RecordCount > 0 then
begin
id_store := FieldByName('id_store').AsInteger;
nom_store := FieldByName('nom_store').AsString;
erro := '';
Result := true;
end
else
begin
// id_store := 0;
erro := 'تعذر جلب بيانات المعلنين';
Result := false;
end;DisposeOf;
end;except on ex:exception do
begin
erro := 'خطأ في التحقق من صحة تسجيل الدخول: ' + ex.Message;
Result := false;
end;
end;
-
thank you very much
-
hello every on , i'm using this code to loop a sqllite database field called 'photos' and not doing the job for me
im using a timer for that named tmr1
where is the problem please thank youps : this loop stop when one of fields value is empty
tmr1.Enabled := False;
if not FDTableTask.IsEmpty and not FDTableTask.FieldByName('photos').IsNull and
FileExists(FDTableTask.FieldByName('photos').asString) then
begin
FDTableTask.next;
// ImageEnView2.PrepareTransition;
// ImageEnView2.RunTransition( TIETransitionType( 1 + random( ord( High( TIETransitionType )) - 2 )), 550);
// tmr1.Enabled := true;
while FDTableTask.EOF do begin
FDTableTask.First;
end;
end;
tmr1.Enabled := true; -
hello every one
I want to play videos one by one , when one finished the second one start and that on ,like slidshow but with videos not pictures ,using tMediaPlayer ,how can I approach that ? or is there a way to detect when start and end of a video ?thank you
-
-
hello every one ..............how to store a video location to database and restore to play it in tMediaPlayer ? thank you
-
good morning every one ^^ how is every one doing ))1- i have fmx android app that s create sqllite db on create ,what's the location of db on the phone and is it const location ? (does not change for every other phones)
2- what's the proper way to copy it from that location to sd card (backup) ?thanks and take care -
36 minutes ago, John van de Waeter said:Hi Tufik,
Hard to say. You included camera, Database, ZXing, min/targetedSDK tweaking, etc.
Too many things that can cause problems.
Start with a blank app. Make sure it runs on all tested devices.
Then add features one by one.
true and thanks for reply and the advice i will try it -
Hello every one ...
I have this very important question and its help a lot if any one can help me with it,
I have an FMX app working normally on some Android versions 5 and 5.1 and 4.4 and with some medication on Android 10and not working at all on other one ,its crash in startup in 6 and 9 ,and on android 7.1 and 8 its stuck on splash screen
i have SDK and NDK and JAVA files set up correctly like the images shown bellow ,I did edit the AndroidManifest.template.xml so minSdkVersion="19" and targetSdkVersion="29"
by the way the app request Camera permission and connect to fire-Dec database app on create cause im using ZXing project in my appwhat's I'm missing here .
-
@Uwe Raabe
Thank you for reply ^ i will try that too ,
and of curse the first solution work just fine too . -
On 9/15/2020 at 1:05 AM, Remy Lebeau said:The simplest option is to use either TThread.CreateAnonymousThread(), eg:
uses ..., System.Classes; procedure TFrmLogin.StartLogin; begin TThread.CreateAnonymousThread( procedure var Success: Boolean; begin try RequestLogin.Execute; Success := RequestLogin.Response.Status.Success; except Success := False; end; TThread.Queue(nil, procedure begin AfterLogin(Success); end ); end ).Start; end; procedure TFrmLogin.AfterLogin(Success: Boolean); begin if Success then begin ShowMessage ('server up'); do something ... end else begin ShowMessage ('server down'); do something else ... end; end;
Or similarly, TTask.Run():
uses ..., System.Threading; procedure TFrmLogin.StartLogin; begin TTask.Run( procedure var Success: Boolean; begin try RequestLogin.Execute; Success := RequestLogin.Response.Status.Success; except Success := False; end; TThread.Queue(nil, procedure begin AfterLogin(Success); end ); end ); end; procedure TFrmLogin.AfterLogin(Success: Boolean); begin if Success then begin ShowMessage ('server up'); do something ... end else begin ShowMessage ('server down'); do something else ... end; end;
I can't thank you enough ,thank s a lot
-
@Remy Lebeau i will try it ,,,,,thank you and ,,, if there any example to how to do this , it will be helpful thank you
-
Hi all Delphier , good morning 😀😀
i have rest firemonkey app ,server , client
im trying to check if the server is up or down from the client side using the code below , the code work fine , but when i run it its freeze the app for a while
is there any proper way to do this ,thank you ,🤓☺️try
RequestLogin.Execute;
if FrmLogin.RequestLogin.Response.Status.Success then
begin
showmessage ('server up')
do something .....end
else
except on e : exception do
begin
showmessage (' server down.... go home ')
end
end;
-
i did get this form the programmer who has written NetCom7 :
you can pass that information to the server by packing it in the aData parameter (for example, you could pack the other client's info and the data with a TStringList.CommaText and pass that as aData). Now, the server will have to unpack the aData, again using TStringList.CommaText,
and i'm trying it right now -
Thank you very much for help , i will try to accomplish what you suggested ,again thank you ^^
-
@aehimself
Thank a lot for reply , and yes there is demo folder , but it s missing what i'm looking for ,
the demos contain chat application ,that all client can see the text message that one client sent
'see the picture'
and i want like i said before
client 1 select client 2 to text with privately , i hope you understand the idea
-
@aehimself
i don't know the guy who made that , and i'm not here for any advertising
by the way maybe he deserve an advertisement ^^ -
hello,I'm nob , and i did tried today NetCom7 and i would like to say
what an amazing project very fast , believe me i know because we have very low connection speed where i live ,
any way ,
i would like to ask you if any one can give us more demos or example about for example chat communication between two selected clients
lets say client one , select client two to chat with , how do you implement that .
thank you all and have a Delphi day
link:
https://github.com/DelphiBuilder/NetCom7
Correctly displaying a Message Dialog in FireMonkey
in FMX
Posted
@Remy Lebeau thanks alot for taking a time to reply ,,,now its work with small change
in line
to
TDialogService.MessageDialog('you are gonna edit something ', TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], TMsgDlgBtn.mbYes, 0,