Topic: Bookmark Manager

I wanted to do a quick bookmark manager app for bookmarking script lines on MVD.
When script lines goes over 1000 lines finding procedures becomes bit of a hassle.

Using one non editable tGrid and one editable tGrid on same form. Couldn't make the connection. When an application selected on non editable table, I like to add bookmarks on editable table.


Please see the attached sample project:

Post's attachments

Attachment icon Dev Bookmarks 3.zip 7.66 kb, 384 downloads since 2017-12-13 

Adam
God... please help me become the person my dog thinks I am.

Re: Bookmark Manager

Adam,
The connection needs to be done by placing the appname field in the bookmark tablegrid. This will cause the inplace edit to put in the combobox in the tablegrid. Unfortunately there are no events associated with tablegrid inplace editing. Therefore when adding a new bookmark there is no place to put in script to default the appname from the appname tablegrid. You just need to select the appropriate app from the dropdown in the tablegrid.

Post's attachments

Attachment icon Dev Bookmarks 3 Revised.zip 584.49 kb, 395 downloads since 2017-12-14 

Re: Bookmark Manager

Hi EHW,


Thank you very much.............
Truly appreciated..................


It'd be a step forward if we could copy the app name from App name tGrid  to editable tGrid combo under App column. I tried the following that didn't work. Most likely for the reason you have stated about the  "inplace edit" tGrid.

procedure Form1_tgMainBookmarks_OnCellClick (Sender: TObject; ACol, ARow: Integer);
begin
Form1.tgMainBookmarks.Cells[3,Form1.tgMainBookmarks.SelectedRow] := Form1.tgMainAppName.Cells[1,Form1.tgMainAppName.SelectedRow];
end;

If the above worked, then we could hide or disable App column on editable tGrid. However, I'm not sure if it's possible to disable editable tGrid column or not.

Adam
God... please help me become the person my dog thinks I am.

Re: Bookmark Manager

Hello AD1408, EHW

You can disable a column in an editable Grid (hide this column ?)

This statement : Form1.TableGrid1.Columns[0].Visible := False;

Here the first column (0) will disappear.

I used this statement when with a very big grid, I want display only some columns
(In this case I use a form listing all the columns and for each of them a checkbox, checked, the column disappears,
unchecked, it appears again).

Is it what your are looking for ?

JB

Re: Bookmark Manager

Jean,
You are right with your statement. However, in Adam's case that particular field (column) needs to be displayed because it is the connection with the Main AppName tablegrid. There is not a way to default the editable value with the App Id value when adding a new bookmark record so that the dropdown does not need to be displayed.


Adam,
As an alternative, maybe the attached could work for you in this case. Basically the edit fields are along side of the tablegrid. As you click or scroll through the bookmarks, you can change any of the values in the edit fields. You do not need to doubleclick on the bookmark row to do an edit. If you do not want to save any changes you make in the bookmark fields, just simply click off the row. Hope this helps.

Post's attachments

Attachment icon Dev Bookmarks 3 Alternative.zip 588.46 kb, 412 downloads since 2017-12-14 

Re: Bookmark Manager

Hi EHW,

I like the alternative you have kindly provided.
Great Stuff.... Thank you very much..... Truly appreciated...........


Hi JB,
It wasn't the case here but thanks for the info.


Dmitry,
Is there any way to link a tgrid record to an editable tGrid?
purpose is;
adding, editing, deleting and displaying details on editable tGrid of selected tGrid record.
Using two tGrids.

Adam
God... please help me become the person my dog thinks I am.

7 (edited by ehwagner 2017-12-15 09:37:58)

Re: Bookmark Manager

I updated the project with some enhancements,  but I removed it.  I thought of a flaw in the project and don't want to put something out that doesn't thoroughly work. If I get some free time,  I'll see if I can fix it and repost it.

Re: Bookmark Manager

Hi EHW,


I had a look at it but couldn't spot the flaw you mention.


Very nice and creative approach, I must admit. It would work fine with fixed form width and grid columns. Top of that we can always add text wrapping on bookmarks tGrid.
In the process I'm learning new things.


Thank you very much..............................

Adam
God... please help me become the person my dog thinks I am.

Re: Bookmark Manager

Adam,
I fixed the flaw in the project posted previously and removed. A new one is attached here. Actually I had to change the design of the previous version. Instead of using a panel for the edit fields on Form1, the edit fields are actually on a separate form (Form2), however it is sized to fit in the tablegrid.. The trick was to make the form look and operate like the panel. In other words, the form is placed on the selected row in the bookmark tablegrid to make it look somewhat like the inplace edit.. It was a little bit of a challenge getting the positioning working properly, but it works.

A couple of things to note. Form2 should have border icons turned off and Borderstyle set to bsNone in the Object Inspector. Also, Positon in the Object Inspector should be set to poDefaultSizeOnly.


This concept could be adapted for other tablegrids, but you would need to play with the hard coded positions in the script to fit other tablegrids. Anyway, hope it's workable for you.

Post's attachments

Attachment icon DevBookmarks3 Enhanced.zip 588.14 kb, 414 downloads since 2017-12-16 

10 (edited by derek 2017-12-16 22:27:42)

Re: Bookmark Manager

Hi Again Adam, EHW,
Your last attachment (devbookmark enhanced3) reminded me of something I wrote from a while back that might be of interest;  the requirement was to 'make it like a spreadsheet' - LOL! 
Like you, I wanted to use the editable tgrid but, for me, it had (and still has) too many issues to be usable - it would have been nice to see some of them addressed with the release of Version 4. 
So I approached it from a different angle by using a normal grid, reducing the size of the column headers to 0, placing edit fields on top of where the column headers would normally go and then scripting (not too much!) so it behaves a bit more like an editable grid.
Maybe this helps in your discussions.
Derek.

Post's attachments

Attachment icon cresta cars.zip 404.5 kb, 401 downloads since 2017-12-16 

Re: Bookmark Manager

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.

Adam
God... please help me become the person my dog thinks I am.

12 (edited by AD1408 2017-12-17 20:58:29)

Re: Bookmark Manager

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.

Post's attachments

Attachment icon Dev Bookmarks 3B.zip 12.3 kb, 436 downloads since 2017-12-17 

Adam
God... please help me become the person my dog thinks I am.