401

(28 replies, posted in General)

Hi nrmuduli,
I'm using MVD 3.5


Hi Derek,

... I imagine a 'not valid integer' error message would occur when you run it without having selected a time from the comboboxes (ie blank hours, blank minutes and blank seconds)...

It seems it's the case.


I tried:

procedure Form1_OnShow (Sender: TObject; Action: string);
begin
  form1.cbHours.text := '00';
  form1.cbMinutes.text := '00';
  form1.cbSeconds.text := '00';
end;

It didn't work, still got blank combo boxes on form1 show.


Here is my latest version of the countdown project, if needed. It only works if manually combo values selected.

402

(28 replies, posted in General)

nrmuduli wrote:

hii,
pls. check


Still get same "" not valid integer error at my end

403

(28 replies, posted in General)

Hi Derek,


Thank you very much...........................
It was nice touch to add elapsed time. Truly appreciated....................


I have tried to apply your script to my version but I got  not valid integer error loop and I couldn't correct it.
Please see the attached sample project.


------------------------------
Edit:
Main issue seems to be with comboboxes. Tried various things without any success.

404

(28 replies, posted in General)

Thanks a lot nrmuduli but thats not exactly what I was looking for.

405

(28 replies, posted in General)

Thanks to EHW and other kind guys here, we have a working Stopwatch.
http://myvisualdatabase.com/forum/viewtopic.php?id=3881


I took Derek's alternative stopwatch and tried to make a CountDown timer. As usual, couldn't get it working. Please see the attached sample project.
Could somebody code it together with it's settings please?
♦ On settings it'd be great if .mp3 sound files supported beside .wav
♦ I used hard coded combox lists so that user can type or choose from combboxes count up to times.

406

(25 replies, posted in General)

derek wrote:

Hi Adam,
I haven't actually tested it but on first glance, shouldn't line 131 in your 'watchexecute' procedure be
Hrs := (ElapsedTime  div 3600000) mod 60;     (it was previously 6000000).
Derek.

Hi Derek,
You are right. Now it counts hours too.
Thank you very much.................

407

(25 replies, posted in General)

Hi EHW,


I have added hours to stopwatch but I couldn't get it increment. Always staying on hour 01 even when elapsed time over 2 hours?

408

(3 replies, posted in General)

Hi Derek,

Looks like it's a case of not seeing woods out of trees on my part. Thank you very much..........


Hi wenchester21,
Thank you very much for the alternative...........

409

(3 replies, posted in General)

I wanted disable a button when there is nothing selected on tGrid and enable it when something selected on tGrid.


I tried this, didn't work:

procedure Form1_OnShow (Sender: TObject; Action: string);
begin
  if Form1.tgMainCustomers.SelectedRow = -1 then Form1.btnAddInvSelectedCust.Enabled := False else Form1.btnAddInvSelectedCust.Enabled := True;

This one didn't work too:

procedure Form1_OnShow (Sender: TObject; Action: string);
begin
  if Form1.tgMainCustomers.SelectedRow = -1 then Form1.btnAddInvSelectedCust.Enabled := False;
  if Form1.tgMainCustomers.SelectedRow = 0 > then Form1.btnAddInvSelectedCust.Enabled := True;
end;

Ended up doing it with two procedures:

procedure Form1_tgMainCustomers_OnCellClick (Sender: TObject; ACol, ARow: Integer);
begin
  Form1.btnAddInvSelectedCust.Enabled := True;
end;

procedure Form1_OnShow (Sender: TObject; Action: string);
begin
  if Form1.tgMainCustomers.SelectedRow = -1 then Form1.btnAddInvSelectedCust.Enabled := False;
end;

Isn't it possible doing with only:
procedure Form1_OnShow (Sender: TObject; Action: string);
begin
......
end;

410

(25 replies, posted in General)

ehwagner wrote:

Adam - Here you go. Just click on the color panels in the Settings form to bring up the color dialog.

Excellent....
Thank you very much...............

411

(25 replies, posted in General)

ehwagner wrote:

Adam,
See if this is acceptable.  I did not use the other forms. I just changed the properties of the main form (Form1). Also, it is not necessary to have an adjustment for the speed so I did nothing with the timer tab. I added a Colors table for looking up colors for the text and background.


Hi EHW,
Great stuff. Thank you very much............... Truly appreciated........................
I was wondering would it be possible to use Windows color dialog like in MVD instead of comboboxes for colors? Windows color dialog may be called by clicking on color panel on settings form or with button. Perhaps Dmitry can help us here...


Hi Mathias,
Thank you very much for the info and the link.....

412

(25 replies, posted in General)

Now we have a working StopWatch thanks to EHW and Dmitry.


Could somebody code the Settings form too please. I have no working idea about how to do it in MVD.

413

(25 replies, posted in General)

DriveSoft wrote:

AD1408
How long you don't restart your PC? Try to reboot.


Aha... didn't think rebooting PC effects it. True I didn't reboot my PC for sometime. After rebooting error message mentioned above is gone.


Thank you very much Dmitry............

414

(25 replies, posted in General)

DriveSoft wrote:

You should use type Cardinal instead Word or Integer

var
StartTime, ElapsedTime: Cardinal;
procedure WatchExecute;
var
    CentiSecs,Secs,Mins: Cardinal;

Thanks Dmitry, I changed the Word and Integer types to Cardinal but still get the same error message?

var
StartTime, ElapsedTime: Cardinal;
Paused: Boolean;


procedure Form1_OnShow (Sender: string; Action: string);
begin
    Form1.btnStart.Visible := True;
    Form1.btnRestart.Visible := False;
    Form1.btnReset.Visible := False;
    Form1.btnPause.Visible := False;
end;

procedure frmLarge_btnStart_OnClick (Sender: TObject; var Cancel: boolean);
begin
  Paused := False;
  StartTime := GetTickCount;
  Form1.btnPause.Visible := True;
  Form1.btnReset.Visible := False;
  Form1.btnStart.Visible := False;
  WatchExecute;
end;

procedure WatchExecute;
var
    CentiSecs,Secs,Mins: Cardinal;
Begin
    While Paused = False do
    Begin
      Sleep(10);
      application.processmessages;
      ElapsedTime := GetTickCount - StartTime;
      CentiSecs := (ElapsedTime div 10) mod 100;
      Secs := (ElapsedTime div 1000) mod 60;
      Mins := (ElapsedTime div 60000) mod 60;
      Form1.lblWatchTime.Caption := Format('%.2d', [Mins]) + ':' + Format('%.2d', [Secs]) +
                          ':' + Format('%.2d', [CentiSecs]);
    End;
End;

procedure frmLarge_btnPause_OnClick (Sender: TObject; var Cancel: boolean);
begin
  Paused := True;
  Form1.btnRestart.Visible := True;
  Form1.btnReset.Visible := True;
  Form1.btnStart.Visible := False;
  Form1.btnPause.Visible := False;
end;

procedure frmLarge_btnReset_OnClick (Sender: TObject; var Cancel: boolean);
begin
  StartTime := GetTickCount;
  Form1.lblWatchTime.Caption := '00:00:00';
  Form1.btnReset.Visible := False;
  Form1.btnRestart.Visible := False;
  Form1.btnPause.Visible := False;
  Form1.btnStart.Visible := True;
end;

procedure Form1_btnRestart_OnClick (Sender: string; var Cancel: boolean);
begin
    Paused := False;
    StartTime := GetTickCount - ElapsedTime;
    Form1.btnRestart.Visible := False;
    Form1.btnStart.Visible := False;
    Form1.btnPause.Visible := True;
    Form1.btnReset.Visible := False;
    WatchExecute;
end;
                  
procedure frmLarge_OnClose (Sender: string; Action: string);
begin
  Form1.btnPause.click;
end;                                        



begin

end.

I wonder is it something todo with my system/date time format. Perhaps script is missing something in taking different time formats into account? Just a wild guess.
I'm using win7 64bit.
Time formats: Short time HH:mm and long time HH:mm:ss


Only thing I could find on the web about this type of error is:
"The problem was caused by trying to store the HardwareID which is a DWORD (or LongInt)
into an Integer field and this one person had a HardwareID which had the high order bit set.

If the high order bit is set on the HardwareID, I make it a negative number and all is well."

415

(25 replies, posted in General)

Did the version I submitted "Stopwatch New.zip" work at all for you?

No, unfortunately it produced the same error too.

416

(25 replies, posted in General)

Adam, I downloaded your updated project, but I do not get any errors. Not sure what to tell you.



Hi EHW,


I tried compiling with MVD 3.6 and MVD 4b beside MVD 3.5 but I still get the following error message on click of Start button.

https://s18.postimg.org/wqa0b7ey1/zzzzz_Temp71.png

417

(2 replies, posted in General)

Hi Dmitry,


Thank you very much....
Truly appreciated..................

418

(25 replies, posted in General)

Thank you very much EHW.......


I get an error message "Overflow while converting variant of type (LongWord) into type (integer)" on click of Start button on Form1.


Ps/.
I changed frmLarge name back to Form1 and added script for checkboxes so that they behave like radio buttons. Please see the sample project attached.
Thank you for economizing on visible buttons.

419

(2 replies, posted in General)

I get an error "Could not convert variant of type (UnicodeString) into type (Double)"


I'm trying to get details of a currency field with decimals displayed on form viaSQL.
To get the currency decimals using:

FORM2.edPriceType01.Value := SQLExecute('SELECT PriceType01 FROM Product WHERE id='+FORM2.tgProducts.sqlValue);

Instead of

FORM2.edPriceType01.Text := SQLExecute('SELECT PriceType01 FROM Product WHERE id='+inttostr(FORM2.tgProducts.dbitemid));

All OK, until I add clear fields script for product form. I need to clear type details when different product type.


Please see the attached sample project.


----------------------------------------------------------------
EDIT:

After some trial and error I found that; instead of clearing fields, making them 0.00 eliminates the above mentioned error message.

Doesn't work:

frmProduct.edPriceType02.Clear;

Works:

frmProduct.edPriceType02.Value := 0.00;

If the above approach is incorrect please let me know.

420

(25 replies, posted in General)

Hi Derek,
Thank you very much... Truly appreciated....
As always a nice alternative.


Hi EHW,
Thank you very much... Truly appreciated....
Almost there. Somebody did a StopWatch with Delphi. I wanted do MVD version. Please see the attached Delphi source if it helps with miliseconds etc. I'm far away from handling Delphi code in MVD.

421

(25 replies, posted in General)

Could somebody code a stopwatch please?
Please see the attached sample project.

422

(7 replies, posted in General)

Hi EHW,


That works. Why I was trying to get sum of salary ID is unknown to me. I guess my one cell brain couldn't work it out correctly.
Thank you very much.......
Truly appreciated..............

423

(7 replies, posted in General)

Hi Dmitry,


Great support. Thank you very much.........
Truly appreciated................


For numbers columns (footer all records salary total) I have added a salary column to the sample project you have kindly supplied for testing purposes.
I have added the SUM line to the script but didn't work?

procedure Form1_GridEmployees_OnChange (Sender: TObject);
begin
    Form1.GridEmployees.Columns[0].Footer.Caption := SQLExecute('SELECT COUNT(id) FROM employees');
    Form1.GridEmployees.Columns[4].Footer.Caption := SQLExecute('SELECT SUM(id) FROM employees');
end;

424

(7 replies, posted in General)

Thank you very much Dmitry......................


No, it's not support. But I think it's possible to implement it using script.

Could you please provide a sample project with script you mentioned?
It'd be great if sample project db contains more than 1000 records.


Would it be possible to get full totals on tGrid footer when displaying/loading limited amount of records rather than just displayed/loaded records total. By tGrid totals  I mean desired/specified tGrid column/s totals on tGrid footer?

425

(7 replies, posted in General)

I come across an older post inquiring about db speed.


Dmitry's advice was to reduce quantity of records to display on tGrid where there are 1000s of records to be displayed. I'm thinking it's very useful and something should be included with all db apps where expected records could be 1000s.

begin
Form1.KeyPreview := True;  // If KeyPreview is true, keyboard events occur on the form before they occur on the active control.
Form1.TableGrid1.dbLimit := 500;
end.

Couple of questions:

♦ In the script above "KeyPreview" is a system syntax or to be used on a the form with a component such as button?
♦ What happens after scrolling 500 (in this case, according to script above) records? Is next batch of 500 records loaded automatically in tGrid?