Jump to content

Lainkes

Members
  • Content Count

    71
  • Joined

  • Last visited

Everything posted by Lainkes

  1. Lainkes

    Set form in read only mode

    Hello, If a record is closed, I need to make the form with all the info read only. Is this possible in one commend? Or do I have to disable all the components one by one? Thanks Alain
  2. Lainkes

    DateTimePicker - Set empty date

    Hallo, I want to assign a null value to a DateTimePicker when a checkbox is checked to tell the user that no date is needed. So I assign the value NULL (found in some other internet topics) that will be converted to '30/12/1899'. DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Date := Null; I get an error message when this code is executed. See attached image. To be complete, this is a DBDateTimePicker (Konopka) that is linked with my datasource. So the meaning is to write directly a null value to the database when hitting the save button on my form. Any idea what I'm doing wrong? Tips and tricks are welcome. Greetings Alain
  3. Lainkes

    Set form in read only mode

    I managed to loop with ControlCount. First I disable all controls on my panel. Then I enable my PageControl. And as last I loop all mu controls on my PageControl and set them disabled. // SET ALL COMPONENTS TO READONLY // Disable first all components for I := 0 to RzPanel1.ControlCount - 1 do RzPanel1.Controls[I].Enabled := False; // Enable TabSheets PageControl1.Enabled := True; // Disable components in PageControl for I := 0 to PageControl1.ControlCount - 1 do PageControl1.Controls[I].Enabled := False; Thanks for the help and hints. Alain
  4. Lainkes

    Set form in read only mode

    I also thought that. But once you disable the panel, nothing can be changed.
  5. Lainkes

    Set form in read only mode

    OK, thanks this is what I was looking for. But one little problem. I have a PageControl. And when I disable the panel, I cannot switch between the different pages of the Pagecontrol.
  6. Lainkes

    DateTimePicker - Set empty date

    It seems that it was not in edit mode after all. My mistake.
  7. Lainkes

    DateTimePicker - Set empty date

    Thanks. But now I get an error on the line DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Field.AsDateTime := Now; when opening my form.
  8. Lainkes

    DateTimePicker - Set empty date

    I added a line with the lowest date possible, but it's not working. I'm sure it's something stupid, but no idea what it is. if TDBCheckBox(sender).Checked then begin // write selected date to DB : OK DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Checked := True; DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Visible := True; DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Date := Now; end else begin // write unusable date to DB : NOT OK DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Date := strToDAte('30/12/1899'); DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Checked := False; DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Visible := False; end;
  9. Lainkes

    DateTimePicker - Set empty date

    Thanks for the info. I'll try to make it more specific. I activated the ShowCheckBox property. I have a DBCheckbox where the user can indicate if more info is needed. (check or uncheck) See screenshot. When the DBCheckbox is not checked, the datetimepicker component must be unvisible. And the date in the database must be set to a value that is not usable (like 30/12/1899). If checked, the datetimepicker must be visible and the selected date must be saved. This is my code. procedure Tfrm_Page_Control.DBCheckBox44Click(Sender: TObject); begin if TDBCheckBox(sender).Checked then begin // write selected date to DB : OK DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Checked := True; DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Visible := True; DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Date := Now; end else begin // write unusable date to DB : NOT OK DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Checked := False; DTP_STAT_HAND_GRIF_VOL_DOSSIER_OPVR_DATE.Visible := False; end; end; But when I uncheck the DBCheckbox, nothing changes in my DB. The last saved date is still available. Thanks for your feedback and help. (or alternative solution).
  10. Lainkes

    Versioning in my program

    Hello, I want to use some kind of versioning in my program. Example every time I build my program, I want to see in a text field the version. (ex 4.1.2). And I also want to see the latest date when the program was build. Maybe even add comments on what I changed in the program. Is this a standard behaviour that I can use from Delphi? Or how can I implement this in my program? Thanks for your advice. Greetings Alain
  11. Hello, I have a form with a button. When the button is clicked, a new form opens to input data. So when this button is clicked, I need to close the current form with the button. This is my code : I have put the Close command in the Finally section. But that's not working. I thought that was the right place, so that even in case of an error the screen is closed. Maybe I'm thinkin wrong. Thanks for your feedback. Alain
  12. Lainkes

    Versioning in my program

    I just want to make it visible like in most programs when you click on the About link in the menu. Is there some kind of tutorial about this? I never used components/code from outside the standard Delphi environment.
  13. Lainkes

    Close current form when opening other form

    I add a screenshot of my form settings. So it's more clear. (I hope)
  14. Lainkes

    Close current form when opening other form

    Thanks. This works as the called form is closed. So this works fine. My program starts with a small login screen where user credentials are needed. When the login is succesful the main form appears. But the login screen is still visible behind the mainform until the mainform is closed. How can I close the login screen directly when the main form is showed. // SHOW MAIN FORM try mainkForm := Tfrm_Main.Create(Self); try mainkForm.ShowModal; finally mainkForm.Free; Release; // CLOSE CURRENT LOGIN FORM end; except on E: Exception do DoShowException(E); end;
  15. Lainkes

    DBCheckbox uncheck all

    Hello, I linked some DBCheckboxes to my database. But when I create a new record, all the DBCheckboxes are filled with black. Even if the default value is set on False in the DB. (Using mariiaDB in HeidISQL). So I was wondering how I can uncheck all these DBCheckbox components. I used this code, but it's stays black. // reset all DBCheckboxes for t := 0 to ComponentCount - 1 do if Components[t] is TDBCheckBox then begin // showmessage(Components[t].Name + ' ' + intToStr(t)); (Components[t] As TDBCheckBox).Checked := False; end; When I do a showmessage, the correct names of the components are shown. Thanks for your feedback Alain
  16. Lainkes

    DBCheckbox uncheck all

    Thanks for your feedback. Greetings Alain
  17. Hello, I have a DateTimePicker field. The value (date) is saved to a field in my database (mySQL). I have a checkbox that indicates that no date is needed when it is checked. How can I write a Null value to my database instead of a date? Thanks Alain
  18. Lainkes

    Assign Null value to date mySQL

    I use this FieldByName('STAT_CLOSED_DATE').AsDateTime := DTP_Close_Dossier.Date;: So I wrrte the value of the DateTimePicker to the database. The database field is a Date format.
  19. Lainkes

    Check if selected row in DBGrid

    Hello, I guess it's an easy solution, but how do I check if a record is selected in a DBGrid? If not selected, a button must be greyed out. If a record is selected, the button becomes active. Thanks Alain
  20. Lainkes

    Check if selected row in DBGrid

    Indeed. I did not notice that. Thanks for the tip. So I don't need to check.
  21. Lainkes

    Check if selected row in DBGrid

    Hello, If a record (person) is selected in the DBGrid, there is a button that must be enabled.. The code behind the button links a new record to that perosn. So if no person is selected, the button must be disabled. Alain
  22. Lainkes

    Encrypt ini file

    Hello, For now, I put my database connection info in an INI file. But due to security, I was wondering if I could encrypt that file so that users cannot read that information. Or is there another solution to protect my INI file? Thanks for your advice Greetings Lainkes
  23. Lainkes

    Encrypt ini file

    Thanks, I'll try to search more info about this topic. If someone has a small example, I would appreciate. I never used 3th party components.
  24. Lainkes

    Encrypt ini file

    Thanks, it makes more sence to encrypt only the data. It's for more advanced and curious internal users. So they cannot see the content.
  25. Hello, I have a database with a lot of fields. There can have the value True of False. Now I want to count the number of records with True values per Field. I can do this per field. But then I have more than 50 SQL statements. SQL.Text := 'select count(*) from tablename where FIELDNAME1 = :FIELDVALUE1 '; ParamByName('FIELDVALUE1').AsString := 'True'; I was wondering if there could be a faster way to retrieve these in one SQL statement. Or is the way I'm working acceptable? Thanks for your advise. Lainkes
×