Jump to content

Lainkes

Members
  • Content Count

    71
  • Joined

  • Last visited

Posts posted by Lainkes


  1. 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


  2. 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.

     


  3. 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


  4. 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;

     


  5. 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).

    2024-04-16 08_49_40-Window.png


  6. 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

    2024-04-15 23_07_47-Window.png


  7. 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.


  8. 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


  9. 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;

     


  10. 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 :

    Quote
    
     // OPEN INPUT SCREEN FOR BOR DOSSIER
                      try
                        inputCheckForm := Tfrm_InputCheck.Create(Self);
                        try
                          inputCheckForm.ShowModal;
                        finally
                          inputCheckForm.Free;
                          Close; // CLOSE THE CURRENT INPUT FORM
                        end;
                      except
                        on E: Exception do
                          DoShowException(E);
                      end;

     

    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


  11. 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


  12. 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


  13. 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


  14. 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

×