Thanks Derek, that solved my problem.

The reason why I'm going for a checkbox to enter a date is because:

1. I want a user to definitely select a 'date received' rather than perhaps accidently clicking on the grid and entering a date, as this is a one time entry. No reversal allowed, or mistakes for that matter smile

2. I intend to have a double click on a specific cell, similar to your example and open up another form.

I have a TableGrid it has  5 columns.  Column 5 has a checkbox enabled by selecting checkbox under 'settings'.

My intention is to click in cell 5 on a specific row and cause the current date to be entered into cell 4. I then want to change the font color of the row.

I have the code below  which partly works, the checkbox appears and the date does get entered into the correct cell.

However, I can click anywhere on the row to get this to happen, what I want is to have just column 5 cell to perform the date function when clicked.

I can't get the row font colour to change at all, though I would be just as happy to have a row grayed out.

procedure frmMain_grdOrders_OnCellClick (Sender: TObject; ACol, ARow: Integer);
 var
     YY,MM,DD:Word;

begin
    DecodeDate(frmMain.DateTimePicker1.DateTime,YY,MM,DD); //get only the date portion of datetime

    if frmMain.grdOrders.Cell[5,ARow].Empty = false then    //checkbox is unticked
    begin
        frmMain.grdOrders.Cell[4,ARow].AsDateTime := EncodeDate(YY,MM,DD); 
        frmMain.grdOrders.font.color:= clGreen;

    end;  
 

       
end;

Any ideas greatfully received.

353

(6 replies, posted in General)

Thank you both for your suggestions.

I was so busy trying to puzzle out why this had happened it hadn't occurred to me to go the simple route of just starting over again.

354

(4 replies, posted in General)

humblelion,

Are you having a problem trying to calculate the sales value or the quantity sold?

Are you using a calculated column to work out your sales?

355

(6 replies, posted in General)

Hi Derek, thanks for looking at the project.

It is still a work-in-progress. Just a warning, if you click the 'Add Order' button, your email client will open.

356

(6 replies, posted in General)

I have hit a strange problem which only has become apparent after I installed v6.2 .

I have a form on which is placed a  Page Control. This control has three tabs.

On tab 2, along with some edit boxes and labels I have placed a Date Time Picker. The picker is appearing on all three tab layouts instead of just the layout of tab 2.

I don't recall this happening with the earlier builds of MVD.

I'm assuming that to solve this problem I'll have to instantiate the date time picker in code rather than from design time or delve into the Forms.xml file and physically move the control into the Tab 2 group.

Any thoughts?

I wonder if you should have

with FORM_NAME.imgList16 do //Eg: frmMain.imgList16
begin
  Masked    :=false;
  ColorDepth:=cd32bit;
  ...
end;

Thank you very much Dmitry, that worked a treat.

Hello,

I am having a problem  working out how to delete an item in a database from an entry in a combobox.

What I'm trying to do is to select an item from a combobox and then click on a button to delete the entry out of both the database and the combobox itself.

The code I currently have is:

procedure frmMain_btnDeleteSupplier_OnClick (Sender: TObject; var Cancel: boolean);
var
    item: integer;
    idx:string;

begin
  
  idx := frmMain.ComboBox2.text;  //get the entry selected from the combobox

{  frmMain.ComboBox2.dbDeleteRecord(16);}  // I feel I should be able to use this somehow
  
  showmessage('Item ' + idx); // shows a message box just for debugging purposes. At this point the correct item shows in the message

  
 frmMain.ComboBox2.dbSQLExecute('DELETE FROM supplier WHERE sup_name =' + idx); //Delete the selected item from the database

 frmMain.ComboBox2.dbUpdate; //Update the database and possibly the combobox
end;

One of my problems is, the above SQL produces and error message 'no such column: item text that I've selected

If someone could point me in the right direction I'd be very grateful.

Do I need to somehow read in the row ID from the DB and then use 'dbDeleteRecord(rowID)'? If so I'm not sure how to do that in MVD.

I am using the trial version 6.1.