Hi JB,
Thanks for the extra information.
However, my question remains unanswered. Please see my previous question above post#9
It's about searching in combobox.
My Visual Database → Posts by AD1408
Hi JB,
Thanks for the extra information.
However, my question remains unanswered. Please see my previous question above post#9
It's about searching in combobox.
I wanted add search in combobox on another form (frmInvoice) where combo field contains firstname and lastname. {firstname} {lastname}
It works fine with last name but not with first name or both together.
on frmInvoice
i.e. typing bai finds all persons with lastname Bailey and lists in combo drop-down OK.
However, typing david or david bai doesnt find anything?
There is a David Bailey saved in person db.
Please see the attached sample projects:
Thank you so much EHW..........................................................
OnAfterClick did the trick.
Thank you so much Dmitry............
I have multiple tabs on form1 with eact tab having tGrid record listing and details of selected grid.
I used just the following to test first tab on form1:
procedure Form1_Button48_OnClick (Sender: string; var Cancel: boolean);
begin
ClearAllComponents(Form1);
end;
However, it cleared everything on the form1 including unselected tGrid records?
After clearing everything info dialog says "No record selected to delete."
I have c/p your A function to clear all components on form script as it's and after added the above script.
I'm sure that I making a mistake but cannot find it:
procedure ClearAllComponents(Form: TAForm);
var
i,c : Integer;
begin
c := Form.ComponentCount - 1;
For i := 0 to c do
begin
IF Form.Components[i] is TdbEdit Then TdbEdit(Form.Components[i]).Clear;
IF Form.Components[i] is TdbEditCount Then TdbEditCount(Form.Components[i]).Clear;
IF Form.Components[i] is TdbMemo Then TdbMemo(Form.Components[i]).Clear;
IF Form.Components[i] is TdbComboBox Then TdbComboBox(Form.Components[i]).dbItemID := -1;
IF Form.Components[i] is TdbCheckBox Then TdbCheckBox(Form.Components[i]).State := TdbCheckBox(Form.Components[i]).dbDefaultState;
IF Form.Components[i] is TdbDateTimePicker Then TdbDateTimePicker(Form.Components[i]).Checked := False;
IF Form.Components[i] is TdbImageDataBase Then TdbImageDataBase(Form.Components[i]).Clear;
IF Form.Components[i] is TdbMonthCalendar Then TdbMonthCalendar(Form.Components[i]).Date := now;
IF Form.Components[i] is TdbStringGridEx Then TdbStringGridEx(Form.Components[i]).ClearRows;
IF Form.Components[i] is TdbFileToDatabase Then
begin
TdbFileToDatabase(Form.Components[i]).Text := '';
TdbFileToDatabase(Form.Components[i]).dbFileName := '';
end;
end;
end;
// --------->> form1 COMPANY tab
procedure Form1_Button48_OnClick (Sender: string; var Cancel: boolean);
begin
ClearAllComponents(Form1);
end;
// --------->> form1 CUSTOMERS tab
procedure Form1_Button3_OnClick (Sender: string; var Cancel: boolean);
begin
ClearAllComponents(Form1);
end;
// --------->> form1 PRODUCTS tab
procedure Form1_Button6_OnClick (Sender: string; var Cancel: boolean);
begin
ClearAllComponents(Form1);
end;
Hi Dmitry,
Is there any solution please?
Hi EHW,
Thanks for your kind help...... Always appreciated.
Lets hope Dmitry provides the remaining solution for clearing remaining field types after delete.
If possible, it needs to clear images, checkboxes, dates, memo and comboboxes field types too
Hi EHW,
Thanks for your kind help...... Always appreciated.
Lets hope Dmitry provides the remaining solution for clearing remaining field types after delete.
If possible, it needs to clear images, checkboxes, dates, memo and comboboxes field types too
I manage to solve out the issue by using a button for lookups with an action new record and updated the script as follows:
procedure MenuClick4 (Sender: string);
begin
form1.btnLookups.click;
end;
I'd have preferred a direct syntax on menu item for new record. Perhaps it's not supported as yet until menu system implemented.
I have posted the following on a different thread with another question, perhaps it's best to post on a new thread here
I have a menu item to launch Lookups form and this form uses MVD v3.1 tGrid with on grid edit only for adding new records.
showModal doesn't work. It needs newRecord action.
procedure MenuClick4 (Sender: string);
begin
frmLookups.'NewRecord';
end;
the NewRecord in above script is not accepted. What's the correct action name for NewRecord please?
Hi JB,
Jezebel from hell asked me to do some accounting app for her and she is very demanding...
On serious note, I still need a help on clearing images, checkboxes, dates and comboboxes field types as stated on my previous post #9.
Added onchange event and it seems to be working atm.
procedure Form1_tgSearchPurchInv_OnChange (Sender: string);
begin
form1.edSaleTabPurchInvTotals.Value:= Form1.tgSearchPurchInv.Columns[6].Footer.FormulaValue;
end;
np JB.
Yes, EHW script is good for clearing multiple fields.
If possible, it needs to clear images, checkboxes, dates and comboboxes field types too beside textboxes.
The following clears tGrid OK:
procedure Form1_tgSearch_Customers_OnChange (Sender: string);
begin
Form1.tgSearchCustInvItems.ClearRows;
end;
To clear images, checkboxes, dates and comboboxes I have tried to add EHW script but it didn't work:
procedure Form1_Button8_OnClick (Sender: string; var Cancel: boolean);
var i : Integer;
begin
For i := 0 to Form1.ComponentCount -1 do
IF Form1.Components[i] is TdbEdit Then TdbEdit(Form1.Components[i]).Clear;
end;
begin
For i := 0 to Form1.ComponentCount -1 do
IF Form1.Components[i] is TCheckBox Then TCheckBox (Form1.Components[i]).Clear;
end;
begin
For i := 0 to Form1.ComponentCount -1 do
IF Form1.Components[i] is TComboBox Then TComboBox (Form1.Components[i]).Clear;
end;
begin
For i := 0 to Form1.ComponentCount -1 do
IF Form1.Components[i] is TDateTime Then TDateTime (Form1.Components[i]).Clear;
end;
begin
For i := 0 to Form1.ComponentCount -1 do
IF Form1.Components[i] is TImage Then TImage (Form1.Components[i]).Clear;
end;
procedure Form1_OnShow (Sender: string; Action: string);
begin
Form1.edSaleTabSaleInvTotals.Value := Form1.tgSearchSaleInv.Columns[9].Footer.FormulaValue;
Form1.edSaleTabPurchInvTotals.Value := Form1.tgSearchPurchInv.Columns[6].Footer.FormulaValue;
end;
procedure CalculateTotal;
begin
Form1.edSaleTabDifference.Value := Form1.edSaleTabSaleInvTotals.value - Form1.edSaleTabPurchInvTotals.Value;
end;
procedure Form1_edSaleTabSaleInvTotals_OnChange (Sender: string);
begin
CalculateTotal;
end;
procedure Form1_edSaleTabPurchInvTotals_OnChange (Sender: string);
begin
CalculateTotal;
end;
The above code copies tGrids footers and calc.
"edSaleTabPurchInvTotals" textbox field (please see img below) needs an update script on change of "t.tgSearchPurchInv.Columns[6].Footer"
Unfortunately, I failed to come up with an update script.
Derek,
Thank you VERY much for quick reply...............................
I tried many variations without var and I couldn't get it working.
Your code with var works fine.
Hi Derek,
..........I got the dates was left out among image fields but couldn't convert the image script below to 'nested select' script:
Form1.dbiSearchDetCustImage.LoadFromDatabase('Customers', 'image', Form1.tgSearch_Invoices.dbItemID);
Derek, I guess the above for Dmitry
Hi JB,
Thanks a lot...
I was looking for short script as in EHW script to handle many fields. Please see the post #1
Hi Derek,
Thank you sooooooooo much...................
I got the dates was left out among image fields but couldn't convert the image script below to 'nested select' script:
Form1.dbiSearchDetCustImage.LoadFromDatabase('Customers', 'image', Form1.tgSearch_Invoices.dbItemID);
I used same script for showing customers details on form1 customers and invoices tab.
Script works for customers tab but not on invoices tab.
Difference is that inv tgGrid on Invoices tab displaying data from InvoiceHeader table therefore invoice details displayed, however customer details are not .
I have linked InvoiceHeader table to Customers table but couldn't get it working.
Please see the attached sample project:
Thank you so much EHW and Dmitry...............................
Assuming I applied the code correctly, not all cleared after a record deleted.
Please see reference images below:
Before deleting Paul Low record
After delete:
Image, date, combobox fields and associated tGrid is not cleared?
-----------------------------------
ps/.
I didn't want to start a new thread for this small issue of mine.
I have a menu item to launch Lookups form and this form uses MVD v3.1 tGrid with on grid edit only.
showModal doesn't work. It needs newRecord action.
procedure MenuClick4 (Sender: string);
begin
frmLookups.'NewRecord';
end;
the NewRecord in above script is not accepted. What's the correct word please?
Is there shorter way of clearing fields after deleting a record?
It's ok using .clear for few fields but when there are too many fields (i.e. over 500) writing a line for each field not an attractive proposition.
Below clears only a single field.
procedure Form1_tgSearch_Customers_OnChange (Sender: string);
begin
Form1.EdSearch_InfoName.Clear;
end;
I have to add over 500 lines similar to
Form1.EdSearch_InfoName.Clear;
Perhaps there is a shorter way of achieving the task?
Thank you so much Dmitry.....................
Thanks Dmitry,
I tried following but get "List index out of bounds (1)" warning
procedure frmSaleTransHist_OnShow (Sender: string); begin frmSaleTransHist.edSaleTransInvTotal.Value := Form1.tgSearchSaleInv.Columns[9].Footer.FormulaValue; end;
???
Edit:
What I'm trying to do is copy tGrid footer values to another form and do calculations there
Please see the Updated sample project 2 with error and calc attached:
Thanks Dmitry,
I tried following but get "List index out of bounds (1)" warning
procedure frmSaleTransHist_OnShow (Sender: string);
begin
frmSaleTransHist.edSaleTransInvTotal.Value := Form1.tgSearchSaleInv.Columns[9].Footer.FormulaValue;
end;
Actually, I wanted copy form1/tgSearchSaleInv footer value.
Corrected frmSaleTransHist component name to edSaleTransInvTotal
This time I wanted to copy tGrid footer value from one form into another form edit field with it's decimals and thousands separator.
Source frmSaleInv tGrid, target frmSaleTransHist / edSaleInvTotal field. I tried the following but didn't work:
procedure frmSaleTransHist_OnShow (Sender: string);
begin
frmSaleTransHist.edSaleTransInvTotal.Value := frmSaleInv.tgSaleInv.Columns[9].Footer.FormulaValue;
end;
Please see the attached sample project:
Looks like I made two simple mistake.
Thanks a lot EHW........................
Attach your project Adam and I'll take a look at it.
Thanks EHW...
Here is the sample project:
My Visual Database → Posts by AD1408
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi