Here's a sample application of the counter. You need to have a counter component in the form and include it in saving the data
201 2021-01-21 05:45:24
Re: How to use the Counter field? It doesn't seem to work? (1 replies, posted in General)
202 2021-01-19 13:48:29
Re: Delete an script (5 replies, posted in Script)
Haw can i delete an script?
Is it the script you want to delete ? If so, what kind of delete? Or you want to delete a record using script?
203 2021-01-19 13:31:30
Re: Message from DriveSoft (Dmitriy) (11 replies, posted in General)
Happy to know you guys are well. Looking forward to your releases.
204 2021-01-16 02:23:04
Re: что с проектом MVDB (16 replies, posted in Talks about all)
I hope dmtry continue and release some updates. Been using MVD for years and it helps me a lot in developing our applications faster.
205 2021-01-14 13:38:52
Re: Calc Field (9 replies, posted in General)
It's because you didn't populate col1 in the previous record
206 2021-01-14 07:54:05
Re: Calc Field (9 replies, posted in General)
brian.zaballa wrote:Been busy, sorry.
You can get it using query in script. Something likeForm2_OnShow (Sender: TObject; Action: string); begin if Action = 'NewRecord' then Form2.EditField.Text := SQLQuery('SELECT `col5` FROM `Chain` ORDER BY `id` DESC LIMIT 1'); end;
Hi Brian,
Thanks a lot for the script, but I get "not enough actual parameters" script error.
My Bad, LMAO, change SQLQuery to SQLExecute
207 2021-01-14 03:44:23
Re: Calc Field (9 replies, posted in General)
Been busy, sorry.
You can get it using query in script. Something like
Form2_OnShow (Sender: TObject; Action: string);
begin
if Action = 'NewRecord' then
Form2.EditField.Text := SQLQuery('SELECT `col5` FROM `Chain` ORDER BY `id` DESC LIMIT 1');
end;
208 2021-01-11 03:33:55
Re: Calc Field (9 replies, posted in General)
can you provide a sample records/result? 5 records i think would be nice.
209 2020-12-30 16:27:34
Re: for loop for all (5 replies, posted in Script)
Good Day.
Here's a sample.
210 2020-12-30 16:22:15
Re: MessageBox with input txt (7 replies, posted in Script)
very good brian.zaballa
is it possible to change input direction to right to left and input position
In other words, how can i make the word (Title ) to the right and the input to the left
thanks for help
I think it cannot be done for that inputbox is a delphi/pascal's function to begin with. If you really want, you can create your own dialog using form and components.
211 2020-12-30 09:41:18
Re: MessageBox with input txt (7 replies, posted in Script)
i used this code
var t : String; begin t := inputbox('Hello', 'Title', 'default'); if t ='123' then showmessage(correct) else if t <>'123' then showmessage('wrong'); end;
but when i press No or X (close) showmessage('wrong') appeared too
can you help me
maybe this will fix it
var
d : String = 'Default Value';
t : String;
begin
t := inputbox('Hello', 'Title', d);
if ((t ='123')) then showmessage('correct')
else if ((t <>'123') and (t <>d)) then showmessage('wrong')
end;
but this will not also show any message when default value is entered
212 2020-12-30 03:28:17
Re: MessageBox with input txt (7 replies, posted in Script)
hello all
how can i make a MessageBox with input txt and YesNo buttons
Yes ===> if input txt = '123' then any code here
No ===> Return
thanks for help
try this.
var t : String;
begin
t := inputbox('Hello', 'Title', 'default');
showmessage(t);
end;
213 2020-12-30 03:24:27
Re: Quick print (16 replies, posted in General)
how about this?
frxReport1.PrepareReport; frxReport1.Print;
Tested this, no luck.
214 2020-12-30 02:46:25
Re: Quick print (16 replies, posted in General)
how about this?
frxReport1.PrepareReport;
frxReport1.Print;
215 2020-12-29 12:54:06
Re: Quick print (16 replies, posted in General)
I am generating report using script.. how can i get quick print and avoid preview..
I am scripting like thisform1.frxreport.print;
But not works...
Try PrintReport instead of print (just guessing)
216 2020-12-29 12:49:49
Re: LastDelimiter (2 replies, posted in General)
I'm not sure if this is what you are looking for but I hope it gives you an idea.
217 2020-12-24 05:45:49
Re: how to calculate a number of spaces for each combobox elements (5 replies, posted in Script)
Here's a close solution to the problem.
var Names : array[0..10] of string;
i,j,longest:Integer;
procedure Form1_OnShow_Event (Sender: TObject; Action: string ;DataSet: TDataSet); begin
Names:=['all','john','alisa','makhmara','kiven','brad toki','salamoiya','lomia gone','steven baloka','irak fone','qutazami phoronix'];
// get length of longest string
longest := Length(Names[0]);
for i:=1 to Length(Names)-1 do
if Length(Names[i]) > longest then longest := Length(Names[i]);
Form1.ComboBox2.Items.Add(Names[0]+' '); // 13 space
Form1.ComboBox2.Items.Add(Names[1]+' '); // 12 space
Form1.ComboBox2.Items.Add(Names[2]+' '); // 12 space
Form1.ComboBox2.Items.Add(Names[3]+' '); // 8 space
Form1.ComboBox2.Items.Add(Names[4]+' '); //12 space
Form1.ComboBox2.Items.Add(Names[5]+' '); // 10 space
Form1.ComboBox2.Items.Add(Names[6]+' '); // 9 space
Form1.ComboBox2.Items.Add(Names[7]+' '); //9 space
Form1.ComboBox2.Items.Add(Names[8]+' '); // 8 space
Form1.ComboBox2.Items.Add(Names[9]+' '); //11 space
Form1.ComboBox2.Items.Add(Names[10]+' '); // 5 space
Form1.ComboBox2.ItemIndex:=0 ;
for i := 0 to Length(Names) -1 do begin
// Names[i]:= ; // how to calculate a number of spaces for each element
if Length(Names[i]) = longest then
Form1.ComboBox1.Items.Add(AddSpaces(Names[i], longest-Length(Names[i])+1))
else if (Length(Names[i]) mod 2) = 1 then
Form1.ComboBox1.Items.Add(AddSpaces(Names[i], longest-Length(Names[i])))
else
Form1.ComboBox1.Items.Add(AddSpaces(Names[i], longest-Length(Names[i])-1));
end;
Form1.ComboBox1.ItemIndex:=0 ;
end;
function AddSpaces(str: String; count:Integer=5):String ;
var
i: Integer;
begin
result := str;
for i:=0 to count do result := result +' ';
end;
{
//https://stackoverflow.com/questions/15294501/how-to-count-number-of-occurrences-of-a-certain-char-in-string
}
function OccurrencesOfChar(const S: string; const C: char=' '): integer;
var
i: Integer;
begin
result := 0;
for i := 1 to Length(S) do
if S[i] = C then
inc(result);
end;
begin
end.
218 2020-12-23 20:20:27
Re: how to calculate a number of spaces for each combobox elements (5 replies, posted in Script)
something like this? Sorry, I'm not so sure on where you are going to use the count of spaces so I just put it in the combobox to showcase
219 2020-12-19 07:18:27
Re: Moving panels on a form (7 replies, posted in General)
Hi Brian,
I'm getting an error message:
"table settings has 97 columns but 3 values were supplied"
I have 96 fields in Settings db tablewhen trying to apply the following script - Using your script:
procedure Form1_OnShow (Sender: TObject; Action: string); var SData : TDataSet; begin SQLQuery('SELECT * FROM settings LIMIT 501', SData); if Not SData.EoF then begin Form1.mainPanel501.Top := SData.FieldByName('mainPanel501Top').asInteger; Form1.mainPanel501.Left := SData.FieldByName('mainPanel501Left').asInteger; end else SQLExecute('INSERT INTO `settings` VALUES (501,501,501)'); SQLQuery('SELECT * FROM settings LIMIT 502', SData); if Not SData.EoF then begin Form1.mainPanel502.Top := SData.FieldByName('mainPanel502Top').asInteger; Form1.mainPanel502.Left := SData.FieldByName('mainPanel502Left').asInteger; end else SQLExecute('INSERT INTO `settings` VALUES (502,502,502)'); SQLQuery('SELECT * FROM settings LIMIT 503', SData); if Not SData.EoF then begin Form1.mainPanel503.Top := SData.FieldByName('mainPanel503Top').asInteger; Form1.mainPanel503.Left := SData.FieldByName('mainPanel503Left').asInteger; end else SQLExecute('INSERT INTO `settings` VALUES (503,503,503)'); end;
That sql query is only applicable to settings table that I've created in the sample which only have 3 fields including id just to give you an idea.
that settings table I created is only intended for 1 record only to handle system settings and that insert query is only applicable if the table only have 3 fields. Safe way to represent it in your case is something like this
SQLQuery('SELECT * FROM settings LIMIT 1', SData);
if Not SData.EoF then begin
Form1.mainPanel501.Top := SData.FieldByName('mainPanel501Top').asInteger;
Form1.mainPanel501.Left := SData.FieldByName('mainPanel501Left').asInteger;
Form1.mainPanel502.Top := SData.FieldByName('mainPanel502Top').asInteger;
Form1.mainPanel502.Left := SData.FieldByName('mainPanel502Left').asInteger;
Form1.mainPanel503.Top := SData.FieldByName('mainPanel503Top').asInteger;
Form1.mainPanel503.Left := SData.FieldByName('mainPanel503Left').asInteger;
end else SQLExecute('INSERT INTO `settings` (id) VALUES (1)');
Note: Make sure you set all fields in your settings table to not null and have a default value 0 or 1, or 2, your choice to prevent an unexpected error.
220 2020-12-17 13:34:06
Re: Moving panels on a form (7 replies, posted in General)
Hi sibprogsistem,
Great stuff.... Thank you very much... Truly appreciated.
How could we restrain move into form edges.. In other word user cannot move panels outside the edges of the form?
Plus how can I save moved panels position so that next time application run shows last set position?Once again thanks for your kind help......
One way I can think of is to save its top and left in database.
Here, I made some modification in sample21 with regards to your question.
221 2020-12-14 14:06:54
Re: how to change from the properties the details of exe (2 replies, posted in General)
does anyone know how to change from the properties the details of the created exe file from the MVDB. I am using win10 64 bit
Try using Resource Hacker, then open your exe. then attached is the picture of the process
222 2020-12-14 08:26:44
Re: Code Libraries (5 replies, posted in General)
brian.zaballa wrote:kweatherhead wrote:I would like to add, from the pages of the gurus... if these libraries are capable to be done, do you suffer loading the entire library or only the code you need (more of a Link time functionality? Is there a way to manage pieces within a library, etc....
Regards,
KeithYou can only use the "Uses" and include .pas file which is a raw code of your libraries.
Brian,
Again a great example !! I presume that you must distribute your Libs with your app if deploying on another system, correct?
MVD does not make a lib.dcu correct?Keith
Yes., So try not to include critical scripts in there.
223 2020-12-14 06:54:59
Re: Built-In Help System (2 replies, posted in Script)
Good day keith,
Here's a sample to give you an idea on the keydown event
224 2020-12-14 06:43:44
Re: Code Libraries (5 replies, posted in General)
I would like to add, from the pages of the gurus... if these libraries are capable to be done, do you suffer loading the entire library or only the code you need (more of a Link time functionality? Is there a way to manage pieces within a library, etc....
Regards,
Keith
You can only use the "Uses" and include .pas file which is a raw code of your libraries.
225 2020-12-12 02:43:55
Re: new design by code (26 replies, posted in Script)
hello all
i want to make message box with ok and cancel
i tired to solve this code
procedure Form1_Button6_OnClick(Sender: TObject); var buttonSelected : Integer; begin buttonSelected := messagedlg('Confirmation',mtError,mbOKCancel, 0); if buttonSelected = mrOK then ShowMessage('OK pressed'); if buttonSelected = mrCancel then ShowMessage('Cancel pressed'); end;
can you help me
thanks for help
you can try this custom function
//Comfirm massages with "Yes or No"
function Confirm(msg: String; ICON: Integer=MB_ICONQUESTION; title:String='Confirm'): boolean;
begin
result := IDYES = MessageBox(msg, 'App Name: '+title, MB_YESNO+ICON);
end;
to use it,
if Confirm('Are you sure?') then begin
showmessage('ok');
end else begin
showmessage('cancel');
end;