2,076

(16 replies, posted in General)

Hi Adam,
Have a look at the attached for having different font styles for different fields (I've cut out all of the code relating to the other issues so I could see more clearly what was needed for the fonts problem.  If it does what you need, you can just cut and paste it back into your original project).
One thing I can't get a handle on is saving different combinations of font styles (ie bold AND italic, bold AND underline etc), but if I remember rightly, that was also an issue in Dmitry's original font change sample project (so I guess I'm in good company!).
With regard to inserting horizontal lines, you could just add '___________'  or '-----------------'  etc to your tablegrid of symbols;  however, you don't know how many dashes or underscores you need to fill a line because, although the memo box on the form is a set width, because you have introduced the facility to change the font, font size etc, you can't tell what will ever fit properly.
Derek.

2,077

(16 replies, posted in General)

Hi Adam and Happy New Year to one and all,
If you want to insert the cell contents (text, symbols - anything) from a tablegrid rather than a combobox, I'd do it this way (see attached) but as always, there may be other options;  I've attached it to a cell_click event rather than a button (it's one click less) - LOL!
Regards,
Derek

2,078

(16 replies, posted in General)

You could always take a subset of the symbols from charmap and add them to a drop-down list and then insert them into the memo as required (in the same way I outlined in my previous post). 
Bear in mind that not all symbols will be supported (but you can see which ones work and which ones don't when you add them to the list - the ones that don't work appear as a small rectangle).
Derek.

2,079

(16 replies, posted in General)

Hi Adam,
I'm struggling to see why you would want to interactively change the font, size, colours etc - maybe someone else could have a look at it (but after a quick glance of the code, it seems that you are now wanting to load 2 different font settings but you only have 1 'savefont' procedure, so both grid and memo will always take the font settings of whatever was last saved).
With regard to the other points, attached is the way that I use to add text either at the end of a memo or part way through it (either by using the mouse or positioning with the keyboard).  It's only a couple of lines of code so it's probably the simplest (which is why I use it - LOL!) but there may be other (better?) ways to do it.
My attachment demonstrates your 'dates' example, but the principle is exactly the same for inserting anything from whatever combobox drop downs you want to place on the form, so you just copy and paste the code as required.  I've used it quite a bit in apps for inserting names and addresses, part numbers and descriptions - that sort of thing.
I've also done it 'on click' of the drop down rather than using a separate button - just seemed a bit neater - but you can put it back on a button if needed.
Regards,
Derek.

2,080

(8 replies, posted in General)

Hi Bruno,
Looks (at least from my end) that the problem lies with the headerstyle object property for the grid. 
If you choose 'hsauto' as the headerstyle (which is the default) then the header colouring works (see the .jpg screen capture in the attachment).  Switch it to some of the other options (hsoffice2010 for example) and you lose the colouring. 
One for Dmitry to have a look at, I suspect.
Attached is your example with the tablegrid headerstyle property set to 'hsauto' which should show your colours.
Out of interest, In the example I sent earlier, the tablegrid headerstyle was already set to 'hsauto' - did that not show up with coloured headers or did  you change the headerstyle property?
Derek.

2,081

(8 replies, posted in General)

Hi 01xbruno,
The syntax of what you are trying to do looks fine.  What event are you associating with altering the colours for the column headers?
In the attached example, I'm using the form1_tablegrid1_onchange event, and it seems to be working as you want.
Regards,
Derek.

2,082

(2 replies, posted in General)

Hi Adam,
Attached is a couple of ways to do it (one of which traps for the 'list index....' error and the other (the simplest) by which it can never happen anyway).
Also is a suggestion for the '...' for when a field is too long (there may be other and better ways of doing it - but as you know, I like to keep things simple!).  You could also combine the '...' with passing the contents of the field that is too long for the label into a 'hint (I've put it in the script just to show how it could work).
Regards,
Derek.

2,083

(17 replies, posted in General)

Hi Lectrond,
Any field that is defined as 'text' should appear, by default, as left justified (and with a left justified heading) in any tablegrid.  For this, you wouldn't need to write any script.
If you could attach your first test database (without the .exe file) where the text was appearing as right justified, I'm sure someone would be able to have a look at it for you and see if something isn't set up correctly.
Also, which version of MVD are you using?
Regards,
Derek.

2,084

(8 replies, posted in General)

Hi Adam,
Totally agree that it's more straightforward if you ignore any pre-sort settings on the grid - I just wanted to find a way around it just in case (and it was a useful learning exercise, as always).
I'll try and have a look at your latest attachment.
Derek.

2,085

(8 replies, posted in General)

Hi Adam, Mathias,
Update on my last post.
Attached is a new version that (I think) gets round the problem of the incorrect record being highlighted when the sorted field is changed.
So, in summary,
1. a saved (inserted) row is highlighted when you go back to the grid.
2. an amended row is correctly highlighted when you go back to the grid (even if the sort order has been changed).
3. a deleted row moves the cursor to the next row in the grid.
Hope this helps and you can follow what the script is doing - pretty messy and there are probably more efficient ways to do it.
Regards,
Derek.

Edit:  just noticed a line of code that shouldn't have been there - taken out and re-uploaded 23.12.2017 @ 17.31 GMT.  Sorry about that

2,086

(8 replies, posted in General)

Hi Adam, Hi Mathias (it's been a while - how are you?),
Yes, I can believe how long you spent on it - it's quite awkward.
It is not so difficult to focus on a record in the tablegrid that has just been inserted by using 'last_insert_id', BUT I think this only works if the tablegrid is unsorted and the new record is therefore always inserted at the bottom of the grid.
But when the tablegrid has a sort sequence, then the newly inserted record can be anywhere in the tablegrid - that's the more awkward bit.
The attached manages to work around that problem but one problem remains that I can't fix.
Here is the scenario -
1.  tablegrid is sorted by name
2.  a record is amended and, for example, the name (ie the field that the tablegrid is sorted on!) is changed from 'Mathias' to 'Adam'.
3.  when the record is saved, the incorrect row is now highlighted ('Mathias' has moved (because of the sort sequence) but the highlight remains on the same tablegrid auto-increment row no' as before).
Any ideas how to work around this (something like a 'last_change_id' - but it doesn't exist - LOL!).
Regards,
Derek.

2,087

(7 replies, posted in General)

Hi Adam,
I spent a few minutes trying different approaches but there's no way you'll ever get it to be a 'true' tree structure with multiple levels, visual indenting of sub-records etc. 
It would be a nice feature to have but there are plenty of things with the existing basic tablegrid that I think could be improved upon first.
Anyway, if you play around with some of the grid settings you can at least make it look okay and showing a hierarchy of tablegrids (in this example, to 3 levels) has never been much of a problem.
Derek.

2,088

(7 replies, posted in General)

Hi Adam,
I've made a change for Form3 so the country is passed through and a change to Form4 so that the country and the state are passed through. 
You also need to remove the parent combobox relationship between combobox2 and combobox1 on Form4.
I didn't originally do it that way not knowing what the requirement was - and I like to keep the coding down to the bare minimum!
With that in mind, rather than use labels to tell the user what the related data is, I'd suggest setting the enabled property all of the comboboxes to 'false'.
Derek.

2,089

(10 replies, posted in General)

Hi Nyzari,
I don't think the problem is due to your filters.
In form wndwspecies / tablegrid1, you are calling a field called individual.outdated that doesn't exist any more.  Looking at your tables, I wonder if you renamed it to individual.archived at some point?  If you make changes to field names, you need to remember to go through and update any old references.
Attached is the fixed project.
Regards,
Derek.

2,090

(7 replies, posted in General)

Hi Adam,
I'm never too sure exactly what people are looking for from a treeview component (or if it differs from a set of hierarchical tablegrids).
Anyway, with that proviso, does the attached help any?  I've not had time to smarten it up or test (and there's not much data in it) it but I think the basics are okay.  I might see if I can think of any other approach if I get some spare time.
Regards,
Derek.

2,091

(10 replies, posted in General)

Hi,
It might be if you've included the .exe in the zip folder.  Try deleting the .exe, zip it again and try uploading once more.
Derek.

2,092

(10 replies, posted in General)

Hi Nyzari,
Any chance you can attach your project so that we can better understand the problem?
Derek.

2,093

(11 replies, posted in General)

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.

2,094

(10 replies, posted in General)

No problem.
The other main way of filtering records, rather than put a filter into the tablegrid itself, is to use a combobox.  If you need any help with that, just let me know.
Regards,
Derek.

2,095

(10 replies, posted in General)

Hi Nyzari,
If I understand your question correctly, the syntax you need is 'boolean field = 0 ' or boolean field = 1 to return filtered values of 'No' or 'Yes'.
Have a look at the attachment (part of an old project) and see how the grids are filtered on 2 boolean fields.
Hope this helps
Derek.

2,096

(2 replies, posted in General)

Hi Vasco,
If I understand you correctly,
1.  to add a breakline in a menu, define the menu caption as '-'  (eg.  myitem.caption := '-';).
2.  yes, once you have defined menu items, they can go down to any level of submenu.
Please see attached which may help to clarify.
Regards,
Derek.

2,097

(9 replies, posted in Script)

Hi Kees,
Is this more what you are after?  (see attached)
Regards,
Derek.

2,098

(9 replies, posted in Script)

Hi Kees,
Welcome to MVD.
You are almost there - you have declared your menu item okay but you also need to insert it with this command
Form1.mniFile.Insert(0, MyItem1);   
Please see attached.
Hope this helps,
Derek.

2,099

(3 replies, posted in General)

Hi Adam,
If you're interested in saving space on forms, a couple of alternative approaches (in the attachment) that I've used in the past might help.
Option 1 - keyboard short-cut (ALT+M) to toggle a menu off and on
Option 2 - use a 'bounce bar' - just take the mouse right to the bottom of the screen to display a menu (very much like the windows taskbar).
And the other option (not included in the attachment) would be to add items to the mouse 'right click'.
Obviously, you can do this with pretty much anything (although both examples I have attached just happen to be for menu options).
I'm sure any of the above can be used in conjunction with Dmitry's solution.
Regards,
Derek.

2,100

(2 replies, posted in SQL queries)

Hi Wenchester,
Please see attached for the way to do it (well, the way that I know - there may be others - LOL!).
Is there any reason why you can't use a 'search' rather than SQLQuery?  I've done both ways in the attachment so you can compare (the 'search' option happens incrementally, the 'sqlquery' needs you to click the button) .
Regards,
Derek.