351

(24 replies, posted in General)

Hi Dmitry and All,


The following utility app has been posted sometime ago by Kim if I remember correctly.  Only some visuals are changed as I could understand it's workings.
https://s17.postimg.org/xo143rnbj/z_Temp100.png


I couldn't get it working, unless I'm doing something wrong.
Purpose is to update earlier version DB file created  with newer version which would have DB tables structure changes such as new DB table/s, Field/s etc.
For instance, I created a MVD application called XYZ v1. Used it and added data to it over time. Then I updated XYZ v1 to XYZ v2. In the process I have added some new tables , new fields to existing DB tables, renamed some existing DB tables and fields. In this situation  XYZ v1 DB file doesn't work with  XYZ v2


It'd be nice to have some little utility that updates older DB file to newer one without loss of existing data. Doing it through SQL Studio is a cumbersome job especially if new tables contains many fields and application was used by many different individual users.


This utility aims to copy DB tables of DB file one at a time. It'd be even better old db gets updated with new one with just a click after specifying old and new DB file locations. It can be used not only by MVD developers but end users too.


Dmitry, Could you possibly give or sell us such an extremely useful utility please?

352

(5 replies, posted in General)

Hi Derek,


Thank you very much for having a look at my question.........


1.  Does Form1 (with Panel1 hidden) shift to the centre (ie BETWEEN Panel1 and Panel2) or shift all the way to the right (to Panel2's position)?

Form doesn't move or shift, just shrinks (width in this case) towards left as much as panel1 width size.


2.  If Form1 calls Form2, where is Form2 positioned?  In the centre of Form1 if Form1 is full size or in the centre of Panel2 if Form1 is reduced size?

It's intended use was for sub forms, no additional forms called from it.
However, if it's used on form1 then as usual MVD defaults or custom form screen position properties would apply. If form2 opened while form1 shrinked (panel1 is hidden) then form2 would appear not exactly on form1 center but somewhere over form1. No additional coding needed for shifting subsequent forms. It doesn't have to appear exact on center of form1.


3.  Your example has no objects that are not part of either Panel1 or Panel2, but in the real world, is that likely? - for example, Form1 has a full width title displaying the name of your application.  What do you do when Form1 is reduced in size? - do you display half the title, lose the title completely or move the title and reduce it by half so that it fits (perhaps having to change font size at the same time)?  The combinations (and complexity) are significant.

Object placements will be taken care on form design stage, taking into account shrinkage. On such forms there cannot be any object width bigger than visible (after hiding) part of the form and anchoring needs to be used appropriately.


At this stage, all I'm asking for a script/code that will sub tthe panel1 width size and shrink the form accordingly and opposite when panel1 shown onclick.
I'm not sure if it's possible but, it'd be nice to have splitter bar hidden too when panel1 is hidden.


Ps/. I know how to show hide and resize the form, when form is static, without sizing and splitter bar. However, on sizeable form with splitter bar I fail.

353

(5 replies, posted in General)

I have a resizable form with a vertical splitter and two panel.

When panel1 is not visible (on click of hide panel1 button) I like the form resize - width reduced as much as hidden panel width. When panel1 shown then form width increased as much as panel1 width - original state.


var Splitter : TSplitter;

// Form1 Vertical Splitter
procedure Form1_OnShow (Sender: string; Action: string);
begin
Form1.Panel1.Align := alLeft;
Splitter := TSplitter.Create(Form1);
Splitter.left := 200;
Splitter.height := 350;
Splitter.Parent := Form1;
Splitter.Align := alLeft;
Splitter.Width := 8;
Splitter.Beveled := True;
Form1.Panel2.Align := alClient;
end;

// SHOW / HIDE LEFT PANEL /////////////////////////
procedure Form1_btnHideLeftPanel_OnClick (Sender: TObject; var Cancel: boolean); // Hide <<
begin
Form1.Panel1.Visible := False;
Form1.btnShowLeftPanel.Visible := True;
Form1.btnHideLeftPanel.Visible := False;
//Splitter.TSplitter.Visible := False (Form1);
//Form1.Width := - Form1.Panel1.Width;
end;

procedure Form1_btnShowLeftPanel_OnClick (Sender: TObject; var Cancel: boolean); // Show >>
begin
Form1.Panel1.Visible := True;
Form1.btnShowLeftPanel.Visible := False;
Form1.btnHideLeftPanel.Visible := True;
//Splitter.TSplitter.Visible := True (Form1);
//Form1.Width := + Form1.Panel1.Width;
end;

Please see the attached sample project if needed.

354

(16 replies, posted in General)

Hi EHW,


Great stuff...........
Thank you very much..............
Truly appreciated.....................


If I understood correctly, now we can save for each memo field their own  font settings properly using your method, using ini file rather than win registry. I don't know why Dmitry used win registry rather than simpler and cleaner ini file in his sample font change project.


On horizontal line; first thank you for explanation and secondly you are absolutely right about unsuitability of using a font for it.
I'm thinking that it needs to be pixels based elastic line instead of a font, without wrap with option to increase vertical pixels count for adjusting height of the line. User may choose line height from pre-defined line heights via combobox. I know it's not some thing but bit like some other MVD components growing and shrinking when form resized where anchors used.

355

(5 replies, posted in General)

Hi Manixs,


Check out the post #1 attachment which may help.
http://myvisualdatabase.com/forum/viewtopic.php?id=3970

It contains these type of combo boxes on frmEmployee. Notice Edit1 and Edit2 textboxes. They are the ones holding combo values in table. I have two of them as I used two combos. Please ignore all the other script mainly relating to font change.
EHW has kindly provided the original solution for me sometimes ago.

356

(16 replies, posted in General)

Hi EHW,


Thank you very much for very useful information......................


Due to lack of having RTF component in MVD I was trying to add some feeble function to memo fields. I don't know when Dmitry is going to add much more useful components such as RTF, treeview etc. However, on version 4, I'd have much preferred to have RTF or Treeview component instead of Google maps. Beside these, the Grid component needs to be updated desperately before anything else due to some difficult or unfixable bugs and missing some features.


I take your point about changing font of components which I was not aware of possibility of creating many issues. I was mainly interested in changing memo field font settings only. Would I still encounter issues that you thinking of? If so, could you give couple of examples please.


...  I would sit down with users during the design phase of the project to decide on a predetermined style of components and leave it at that. ...

It's fine if application developed for a specific user but when general public use is the case then....


... Just an FYI, you are not obligated to store these values in the Windows Registry. You can also store your app settings in an "ini" file or just a plain text "txt' or 'csv" file. Or in a table similar to your stopwatch project.

Agreed. I'm not fun of using registry for storing settings etc. In fact I don't like Windows registry a bit.
I played around doing table version but failed. For learning purposes, if and when you have bit of free time could you please apply table and ini or text file based settings to the above Derek's latest sample project "changefonts.zip"


You and Derek have been great teachers for me here. Once again Thank you so much to both of you ......................................


Happy New Year.............

357

(16 replies, posted in General)

Hi Derek,


Thank you very much for the latest update..........

... One thing I can't get a handle on is saving different combinations of font styles (ie bold AND italic, bold AND underline etc) ...

Hopefully, Dmitry will provide the solution here.


On inserting Horizontal line front, I'm thinking that we can create a line in various heights as a font  and insert it same way as in combo symbol insertion. Only issue here is getting line font filling (repeat) one horizontal line to fit to the memo current width. Taking into account form together with memo field may be resizeable.

358

(16 replies, posted in General)

Hi Derek,


Great stuff.....
Thank you very much...........
Your kind help has always been a great learning source for me and I'm sure for other MVD users too.


Now, on this learning project outstanding items reduced down to two thanks to your help.
♦ Font issue;
  - Being able to save different fonts for different components or same components different instances. i.e. If I have 2 grid and 3 memo fields,
    I like to be able to save their own font settings separately.
  - Auto adjust grid row heights according to font size specified.
♦ Inserting horizontal line into memo field.

359

(16 replies, posted in General)

Hi Derek,


Thank you very much for the latest update......................


I have tried adding and inserting symbols the way I like to do it within MVD using grid. Almost there but not quite. I couldn't come up with a code for inserting selected grid cell symbol into memo field onClick of the button?

Please see the attached sample project.


Also thank you for showing how to insert pre-defined phrases into memo.


ps/ I have changed inserting symbols with combobox slightly, so that user can add and edit symbols list via grid. Beside, for myself having combo data managed within MVD rather than embedding into db is better as I tend to alter db quite often and therefore start with blank db file.


Happy New Year .................................

360

(16 replies, posted in General)

domebil wrote:

procedure Form1_Button22_OnClick (Sender: string; var Cancel: boolean);
begin
    OpenFile('C:\Windows\system32\charmap.exe');
end;


Thanks a lot for the code to get Win Characters Set domebil.
What I wanted to do is to display Characters Set on my own form and insert selected character directly on the memo field at cursor point on a click of "Insert" button as on the screen cap above. Beside Win Characters Set doesn't copy a selected character in a way that MVD accepts.


Unfortunately, all issues mentioned on my previous post #3 remains unresolved.

361

(16 replies, posted in General)

Hi Derek,


Thank you very much for the updated sample project.


Since we don't have a RTF component in MVD, changing font attributes on component level where appropriate can offer something extra at present.

... it seems that you are now wanting to load 2 different font settings but you only have 1 'savefont' procedure, ...

I couldn't work out component level savefont procedure so that each component keeps their font settings. Is it doable to have multiple font save procedures for each component? Such as having font settings for grid, memo1, memo2 separately - in this case 3 different font settings.


Is it possible to auto resizing grid row height according to defined font size?


I couldn't understand and couldn't see any code for right click menu items you have added. What they do?
On symbol insertion, i meant to get symbols on a form and insert selected one from there. Something like:
https://s17.postimg.org/ntrdpvfa7/zzz_Temp1.png


I guess you don't have any trick for inserting horizontal line in memo field at present?

362

(16 replies, posted in General)

I got Dmitry's font change sample project for font change for grid and wanted to add additional font change on memo fields too.
However, couldn't get it working properly.


Issues:
♦ When changing memo font same font changes reflects on grid font too. In other word both components font settings shows the same font size color etc.
♦ I couldn't get grid rows to resize (vertically) to accommodate larger font sizes.


Additional features for memo field:
I'm not sure any of the below is available in current MVD. If not, perhaps Dmitry can help us on items below, when he takes a bit of break on Vodka in these festive season.

  • Insert Horizontal Line at cursor point.

  • Insert Current Date and time at cursor point.

  • Insert Symbol via some form of symbol map.


Please see the attached sample project:

363

(2 replies, posted in General)

Hi Derek,


Thank you very much for the error elimination and for label length solution with alternatives .........................
Truly appreciated...........................


I like the approach of going to source (DB Table) rather than getting it from tGrid cell. This would also prevent need of script update when columns order on related tGrid changed.


On text display length, including hint has been additional bonus for me. One thing, when applying hint, we need to make sure item properties ShowHint checked.

364

(2 replies, posted in General)

I'm using label to display a value from tGrid

Form1.label4.Caption := Form1.TableGrid1.Cells[0,Form1.TableGrid1.SelectedRow];

It works OK, if tGrid has a record.
If tGrid is empty, doesn't contain any record (row) then it produces "List index out of bounds (-1)" error.
onShow event.


In order to eliminate the error I tried

if form1.TableGrid1.dbItemID < 0 then Form1.label4.Visible := False else Form1.label4.Visible := True;

Tried it with dbItemID, RowCount and SelectedRow without a success?


------------------------------------------------------


On label front;
When a value doesn't fit the allocated label length, how can I get it displayed ending bit with 3 dots.
i.e.
This is a long name that doesn't fit
if I turn auto size to false it displays
This is a long name t
I like to display it as:
This is a long nam...


Happy New Year to All...................................

365

(8 replies, posted in General)

Hi Mathias,


Very nice treeview you have created. Thank you very much for sharing................ Truly appreciated..................
Compare to you, I'm a nob. Would you be so kind to demonstrate with a basic application how to put it in use?
You don't need to include "Backup" folder as you already have included it in your upload above.


Hi Derek,


As I try to do more with MVD's current tGrid, I come across more flaws of it.
I found out that, issue of not selecting last saved record was happening when tGrid set to use child records. It may also be same with tGrids populated via search.
Also, if text wrapping, padding script included for the tGrid same issue appears again.
It'd be great if you can find a workaround about these issues without breaking our tGrids chain.

366

(8 replies, posted in General)

Hi Derek, Mathias,


Thanks for the latest workaround Derek.....
As usual nothing can escape from you.


I was mainly trying to apply after save row selecting and focus for treeview simulation. Derek, I started with your cities example applying Math's method as it seemed to be simpler approach. It works with grid1 fine but doesn't with grid 2 and 3. Could it be the reason that grid 2 and 3 retrieves data via search action? Is there solution for this? I couldn't get it working. I don't need grid sorting via grid settings.


Also, after delete I wanted next selected record display it's details (in this case review memo content) but couldn't. Tried adding cellclick for delete button but couldn't make it work?


Please see attached sample project:

367

(8 replies, posted in General)

Hi Mathias,


Nice one...
Thank you very much..................
Truly appreciated........................
You wouldn't believe how long I spent on this trying all kind of things with selectedRow and scrollToRow.... Now, I can go and get a drink thanks to you Math.


I used it like this:

var lid : Integer;
// TG 1
procedure Form1_btnLIDtg1_OnClick (Sender: TObject; var Cancel: boolean);
begin
  lid := Last_Insert_id;
  form1.TableGrid1.dbItemID := lid;
  form1.TableGrid1.SetFocus;
end;

procedure Form2_btnDetSave_OnAfterClick (Sender: TObject);
begin
  form1.btnLIDtg1.Click;
end;

// TG 2
procedure Form1_btnLIDtg2_OnClick (Sender: TObject; var Cancel: boolean);
begin
  lid := Last_Insert_id;
  form1.TableGrid2.dbItemID := lid;
  form1.TableGrid2.SetFocus;
end;

procedure Form3_Button1_OnAfterClick (Sender: TObject);
begin
  form1.btnLIDtg2.Click;
end;

Var is declared as global since I have more than one tGrid and used hidden add button.


Merry Christmas................

368

(8 replies, posted in General)

I have Form1 with a tGrid and Form2 for adding record to tGrid on Form1.


I cannot get the saved record selected and focused on Form1 tGrid after clicking a save button on Form2 with the script below:

procedure Form1_OnShow (Sender: TObject; Action: string);
begin
  form1.TableGrid1.selectedrow := 0;
  form1.TableGrid1.setfocus;
end;

procedure Form2_btnDetSave_OnAfterClick (Sender: TObject);
begin
   Form1.TableGrid1.SelectedRow := Last_Insert_id;
   form1.TableGrid1.setfocus;
end;

procedure Form1_btnAdd_OnAfterClick (Sender: TObject);
begin
   Form1.TableGrid1.SelectedRow := Last_Insert_id;
   form1.TableGrid1.setfocus;
end;

procedure Form1_btnEdit_OnAfterClick (Sender: TObject);
begin
  form1.TableGrid1.setfocus;
end;

procedure Form1_btnDelete_OnAfterClick (Sender: TObject);
begin
  form1.TableGrid1.setfocus;
end;

.

Could Dmitry or somebody tell me what's wrong with the script please?

369

(7 replies, posted in General)

Thank you very much Derek...............................
Your help is truly appreciated..................


Calc field - Record count is very nice addition. I like it. Thanks for that too....


Only thing is missing, which I cannot work out, after save event where saved record is selected and focused.

... but there are plenty of things with the existing basic tablegrid that I think could be improved upon first.

Totally agreed. Table grid is perhaps the most important component of a database application. MVD deserves much better one than what is in use at present.
As far as I know MVD is using unsupported (older) version of NextGrid. At the least it should be updated to new version IMHO. Perhaps new version may clear some bugs and offer additional features. I hope Dmitry will update it very soon.

370

(7 replies, posted in General)

As mentioned on previous post, I have tried to implement cell selection / focus after delete but couldn't get it working fully.


I also added to hide relevant grid etc when there is no data on them.


Please see the attached latest version of the project below:
edit: 20/12/2017 20:24:53 (GMT+1)
My apologies. Wrong version of the project was uploaded. The attachment is updated.

371

(7 replies, posted in General)

Hi Derek,


Great stuff.........
Thank you very much...........................
Truly appreciated...................................


See if I'll be able to add a little script for tGrids so that after save focuses on saved and delete next available record.


---------------------
EDIT:

Tried for each table;

procedure Form4_Button1_OnAfterClick (Sender: TObject);
begin
Form1.TableGrid3.dbItemID := Last_Insert_Id();
end;

but couldn't get it working.

372

(7 replies, posted in General)

Hi Derek,


Thank you very much for the sample project............
Looks like my one cell brain failed me again on linking tables.


Your sample project Cities is almost there. When adding state/county and city, combo boxes shouldn't be there.  If country and state/county are selected on form1 tGrids, app should know in which country and state/county city need to be added to. So user doesn't have to do same thing twice. However, replacing combos with labels informing user where their record will be added is very useful.


I think Treeview is just a single grid that data is arranged in hierarchical fashion. However, treeview offers many features as oppose to using multiple grids IMHO. So, I'm still awaiting eagerly for Dmitry to add treeview component to MVD.

373

(7 replies, posted in General)

As we do not have much wanted treeview component yet in MVD, I was trying to put together a rough treeview navigation using tGrids.


I have tried to get some ideas and use from one of Derek's sample project, needles to say I've failed. I think I couldn't work out linking correctly.


Please see the attached sample project.

374

(11 replies, posted in General)

Here is a bit of challenge for those who have some hair left on their head.


I made a minor changes to EHW's  "Dev Bookmarks 3 Alternative" in an effort to make as much as possible foolproof.
There is always some issues for me when enabling and disabling buttons etc based on tGrid values. I made a start but just couldn't work out operators based on tGrid values.


Here is what I was trying to do (Hopefully, there is no logic floor in my explanation, I wouldn't be surprised if there is tho)
♦ All buttons and edit boxes are disabled via on their properties


♦ When there is no record on application and bookmarks grid;
Only app grid ADD button is enabled. Form EXIT button is always enabled.
(All bookmark Text Boxes remains as not enabled.)


♦ When there is one or more record on application grid but no record on bookmarks grid;
App grid ADD. EDIT and DELETE buttons are enabled.
Bookmarks grid ADD. EDIT, DELETE and SAVE buttons are  not enabled.
(All bookmark Text Boxes remains as not enabled.)


♦ When there is one or more record on application and bookmarks grid;
App grid ADD. EDIT and DELETE buttons are enabled.
Bookmarks grid ADD. EDIT, DELETE buttons are enabled but SAVE button remains as not enabled.
(All bookmark Text Boxes remains as not enabled.)


♦ When Bookmarks grid ADD button clicked;
App grid ADD. EDIT and DELETE buttons are not enabled.
Bookmarks grid CANCEL and SAVE buttons are enabled but EDIT and DELETE buttons are not enabled but SAVE button are not enabled.
All bookmark Text Boxes are enabled.


♦ When Bookmarks grid EDIT button clicked;
App grid ADD. EDIT and DELETE buttons are not enabled.
Bookmarks grid CANCEL and SAVE buttons are enabled but ADD and DELETE buttons are not enabled.
All bookmark Text Boxes are enabled.


♦ When Bookmarks grid DELETE button clicked;
App grid ADD. EDIT and DELETE buttons are enabled.
Bookmarks grid ADD and EDIT buttons are enabled but CANCEL and SAVE buttons are not enabled.
All bookmark Text Boxes are not enabled.

• After DELETE Bookmarks grid selects/focuses to the next available record and displays details on bookmark text boxes. If there is no record left on bookmarks grid after delete then;
All bookmarks grid buttons are not enabled except ADD button.
All bookmark Text Boxes are not enabled.


♦ When Bookmarks grid CANCEL button clicked;
App grid ADD. EDIT and DELETE buttons are enabled.
Bookmarks grid ADD, EDIT and DELETE buttons are enabled but CANCEL (for cancel button after click event) and SAVE buttons are not enabled.
All bookmark Text Boxes are CLEARED.
All bookmark Text Boxes are not enabled.


♦ When Bookmarks grid SAVE button clicked;
App grid ADD. EDIT and DELETE buttons are enabled.
Bookmarks grid ADD, EDIT and DELETE buttons are enabled but CANCEL and SAVE (for save button  after click event) buttons are not enabled.
All bookmark Text Boxes are not enabled.

• After SAVE Bookmarks grid selects/focuses to the saved record and displays details on bookmark text boxes.


♦ On grid cell click and key up;
Bookmarks grid ADD, EDIT and DELETE buttons are enabled but CANCEL and SAVE buttons are not enabled.
All bookmark Text Boxes are not enabled.


♣ Also it needs foreign key restraints for App Grid DELETE button, in order to prevent deleting app record if it contains bookmark record/s.

Avoiding applying disable/enable to panels containing buttons etc,. Buttons etc in disabled panels still looks as enabled, except mouse over color.


Thinking about it, actually it may need a use of fake edit button too?
Please see the attached sample project.

375

(11 replies, posted in General)

Hi EHW,
Thank you very much for the enhanced version.... It was very kind of you.


On button edit click, form2 position wasn't keeping it's position when form1 is moved. I have commented out the following:

procedure Form1_btnEditBookmark_OnClick (Sender: string; var Cancel: boolean);
begin
    Form2.Left := Form1.Left + 20;
    If tgPos = 0 then Form2.Top := Form1.Top + 262 else
      Begin
        If tgPos >= 350 then tgPos := 350;   
        If tgPos <= 22 then tgPos := 27;
        Form2.Top := tgPos + 288;
      End;
end;


Added the following:

procedure Form1_btnEditBookmark_OnClick (Sender: string; var Cancel: boolean);
begin
    form1.tgMainAppName.dbItemID := Last_Insert_Id();
    form1.tgMainBookmarks.Enabled :=True;
    form1.button1.click;
end;

It seems to be working OK but I'm not sure if it's correct thing to do.


Hi Derek,
Thank you very much for the sample project.....
There are certainly few things I can learn from it.