Roberto Nicchi
-
Posts
226 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Roberto Nicchi
-
-
I have first created my application as standalone project.
Now i have created the service application project.
The service start and works fine but when i try to stop it, it doesn't respond and can't be stopped.
The problem seems related to a thread that is created in the servermodule. If i remove this thread, the service can be stopped with no problem.
Probably i'm not doing it correcty. I'm going to describe how it work:
In the server module oncreate event i have used a code like this:
FmyThread:=Tthread.CreateAnonymousThread(myproc);
FmyThread.Start;FmyThread is defined in the private section of the server module.
In the server module onbeforeshutdown event i have placed code to terminate the thread
FmyThread.Terminate;
The myproc procedure is like this
procedure TUniServerModule.myproc;
var
Start,Finish:Tdatetime;
const
SecBetweenRuns = 60;
begin
Start:=now;
while not Terminated do
begin
Finish:=now;
if SecondsBetween(Start,Finish)>SecBetweenRuns then
begin
// Do something, the code execution is faststart:=Finish;
end;sleep(1000);
end;
end; -
Ok i have the solution. See below. Let me know if there's another (better/faster) solution.
In the button have defined the JS event click (in Extevents)
function click(sender, e, eOpts)
{
if (confirm("Confermation request")==true)
ajaxRequest(sender, '_doit', []);
}in the button have definied the onajaxevent event
if EventName = '_doit' then
begin
modalresult:=mrOk;
end;
-
10 minutes ago, Roberto Nicchi said:
Ok, only now i have realized that there's a showmask property in the Tunibutton
It works fine BUT, if in the button onclick event a messagedlg method is executed, the mask is not visualized. Is it WAD ?
thanks
I was folgorated by an idea. Maybe I have to make the request for confirmation with JS code ? If this is correct could anyone tell me how? Unfortunately my knowledge of JS is zero.
-
Ok, only now i have realized that there's a showmask property in the Tunibutton
It works fine BUT, if in the button onclick event a messagedlg method is executed, the mask is not visualized. Is it WAD ?
thanks
-
29 minutes ago, Sherzod said:
Hello,
Here is a similar topic (in Russian).
Great! It works correctly!
Thanks a lot!
-
Hayri,
I'm sorry, but it isn't the correct solution for me.
I need the same visualization (that is, multiple pages if records are more than x), but without slidebar.
After that, I add 4 buttons (next, previous,first,last page) for move between pages (to replace the slidebar)
-
-
20 minutes ago, Roberto Nicchi said:
Ok, thanks.
Roberto
BUT if in the button that close the form i want a confirmation (see below), again there's the same problem. Is there a workaround for this ?
if messagedlg('Confirm ?',mtConfirmation,[mbyes,mbno])=mrYes then
begin
ShowMask('Please wait ...');UniSession.Synchronize;
modalresult:=mrOk;
end;
-
46 minutes ago, Farshad Mohajeri said:
This error shows that Synchronize() can not be called here for different reasons.
You should not use Synchronize to display masks. Simply enable ScreenMask property of the Button which closes the form.
Ok, thanks.
Roberto
-
I have the exception "ProcessEventQueue(): Worker is not assigned." when the statement "UniSession.Synchronize" is executed in the code below.
Is my code wrong ?
thanks
procedure Tmyframe.create_report;
var
dest:Tdest_report_frm;
begin
dest:=Tdest_report_frm.Create(uniGUIApplication.UniApplication);dest.showmodal(procedure(sender:Tcomponent; res:integer)
begin
if res=mrOk then
begin
ShowMask('Please wait ...');
UniSession.Synchronize; <--- EXCEPTION HERE
try
CreateTheReport;
finally
HideMask;
UniSession.Synchronize;
end;
end;
end
); -
Mehmet,
your solution work! thanks a lot!
My implementation:
Quoteprivate
var columnIDX,recordIDX:integer;
tunidbgrid->clientevents->extevents->childdoubletap
function childdoubletap(sender, location, eOpts)
{
ajaxRequest(sender,'_doubleclick',["colidx=" +location.columnIndex, "rowidx="+location.recordindex]);
}tunidbgrid->events->onAjaxEvent
if EventName = '_doubleclick' then
begin
columnIDX:= Params['colidx'].AsInteger;recordIDX:= Params['rowidx'].AsInteger;
end;
tunidbgrid->events->ondblclick
if columnIDX=0 then
begin
//do something
end;
-
Mehmet, I'll try your solution and I hope to resolve the problem.
Thanks.
-
-
Hi,
I need help.
I have a TunimDBgrid (for mobile). I would like to open a new form if i make a double click in a specific cell.
How i can impliment grid.dblclick? How i can get the colomn.index or name?
Thanks.
-
Regarding this problem i have created a support ticket but maybe somone else here can have a solution to the problem.
It happens that the tab stop sequence is not correct when cycling with TAB (and SHIRT-TAB) between components. My application is made of a main form and frames, that opened inside the main form.
I have attached to this message a self explained example that shows the problem.
thanks
-
What i need is to select the rows of a grid depending on some condition. The condition in this particular case is the value of a field; if the field has some value the record must be selected, otherwise not selected. This task must be executed after the grid has been loaded so i guess the right place where to place the code is in the OnAfterLoad event of the grid.
Now i have the code to select or deselect all the rows but i have no idea how to select/unselect rows with a condition.
Possible ?
thanks
-
37 minutes ago, Hayri ASLAN said:
Hello
Please try below code
procedure TMainForm.DBGridAfterLoad(Sender: TUniCustomDBGrid); begin with UniDBGrid1, JSInterface do JSCallDefer('getSelectionModel().selectAll', [], 100 ); end;
This works fine, thanks
-
On 10/30/2018 at 1:48 PM, Sherzod said:
Maybe you should try this approach for now:
1.
YourGrid.JSInterface.JSAssign('needToSelectAll', [True]); //<--------- liste.SQL.Clear; liste.SQL.Append('SELECT * FROM ANTEILE WHERE GUNST_INR = '+STRUKTUR1.FieldByName('INR').asstring+' ORDER BY VERTRAG_NR desc '); liste.Open;
2.
YourGrid -> ClientEvents -> ExtEvents -> function store.load // or use the OnAfterLoad event of your Grid with some conditions
function store.load(sender, records, successful, operation, eOpts) { if (sender.grid.needToSelectAll) { Ext.defer(function () { sender.grid.getSelectionModel().selectAll() }, 100); } }
I'm trying this thing but sincerly i don't understand in what ext event i have to place the store.load function.
I'm new to JS and UNIGUI
I have tryed also to place the code UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();'); in the onafterload event of the grid but it has no effect. If i use the same code in a popup menu works fine.
thanks
-
My unigui application creates Tuniframe inside Tunitabsheet
At the end of the process the INIT method is executed.
The INIT method defined into the frame should move the focus to the desired component (setfocus). Anyway it doesn't work. this focus is somewhere (don't know where) and not in the correct component. I'm doing something wrong ?
thanks
var
ts:TUniTabSheet;
idx: Integer;
frame:Tstandard_frame;
begin
ts:=TUniTabSheet.Create(self);
ts.Closable:=true;
ts.PageControl:=pc;
ts.Caption:='The frame';
frame:=Taframe.Create(ts);
frame.Parent:=ts;
frame.Align:=alClient;
frame.Show;
pc.ActivePageIndex:=ts.PageIndex;frame.Init; // THIS METHOD SHOULD MOVE THE FOCUS EXECUTING THE SETFOCUS METHOD OF THE DESIRED CONTROL (SEE BELOW)
end;.......
procedure Taframe.init;override;
.....
procedure Taframe.init;
begin
acontrol.SetFocus; // I'm sure this method is executed because i have placed here a showmessage
end; -
Perfect, thanks a lot !
Roberto
- 1
-
In short: is it possible to execute some Delphi code when the refresh button of a TUniDbGrid is clicked ?
thanks
-
I have a TuniDbGrid that load data from a query component.
The refresh button of the grid doesn't refresh the query.
Is there an event i can use to update the Tquery before data is loaded by the grid ?
thanks
TThread in UNIGUI service. The service can't be stopped.
in General
Posted
Got it, thanks !
Roberto