Lainkes
Members-
Content Count
72 -
Joined
-
Last visited
Everything posted by Lainkes
-
Good evening, I have a program that shows a grid with records (client data). I was wondering what the best practices is to use this form for adding a new client or editing a new client. I was thinking to use a boolean flag (new_client := True or false). If the flag is True, I know that the form is for adding a new client, so I use the append option. When False, I know it's just for editing the data. Or do I use 2 different forms for this purpose? Thanks for your feedback. Greetings Lainkes
-
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
-
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
-
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
-
I also thought that. But once you disable the panel, nothing can be changed.
-
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.
-
It seems that it was not in edit mode after all. My mistake.
-
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.
-
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;
-
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).
-
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
-
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
-
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.
-
I add a screenshot of my form settings. So it's more clear. (I hope)
-
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;
-
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
-
Thanks for your feedback. Greetings Alain
-
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
-
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.
-
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
-
Indeed. I did not notice that. Thanks for the tip. So I don't need to check.
-
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
-
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
-
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.
-
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.