326

(16 replies, posted in General)

Hi Adam,
"Regular" font style has a value of 0, "Bold" is 1, "Italic" is 2, "Bold Italic" is 3. "Underline" is 4. "Strikeout" is 8. If you have "Bold Underline" then the value is the combination of "Bold" (1) and "Underline" (4) for a value of 5.  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.


However, in my personal opinion, I would not allow users to change fonts on components in a project. You are opening yourself up to a whole lot of issues and a whole lot of script to accommodate for all the possible combinations of fonts and sizes of components. I just would not want to tackle such a task. Instead, 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. But this is just my personal opinion.


As far as inserting a line, I have done just what Derek has shown and used dashes to separate sections of a memo field. You really do not need to put a full line across the memo field for separation. I have projects where memo fields are used more or less as a journal. I typically use a series of 10 or 20 dashes on a line and a date on another line and it visually looks fine for a separation..


I know this isn't what you are looking for, but I'm just trying to keep you from having a lot of headaches down the road. :-)

327

(11 replies, posted in General)

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.

328

(11 replies, posted in General)

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.

329

(11 replies, posted in General)

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.

330

(11 replies, posted in General)

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.

331

(5 replies, posted in Script)

Use "Exit;"

332

(28 replies, posted in General)

Adam,
I put in the progress bar and flashing message. I didn't see that Derek already put the flashing message in with a subsequent post.  Mine is a little different in that it only flashes a few times with red and blue colors, then stays solid. You can control the speed of the flash by changing the "sleep()" command. You can also control the number of times it flashes with the For Loop max. If you want continuous flashing then you should use Derek's solution.


Also, as an alternative to the message length, I put in 19 in the maxlength in the object inspector. I expanded the message window a little so you can see Derek's caption better. I placed the max in there as well. When the user reaches the max length, the system beeps and they can no longer enter any more characters. The result is the same, but no popup error message is required with user intervention to close the info window. Just something else to put in your library of MVD knowledge.

333

(28 replies, posted in General)

Values (1,65280,0,65280,65280,0,0,0,0,0,16776960,16776960,16776960,"")');

The values between the commas typically follow your database table definition in MVD. However, I noticed that the definition in your MVD table definition for Settings does not exactly match the actual table definition. Somewhere along the way you must have moved around the column definitions in MVD. Doing so is fine, but the actual database definition order does not get changed outside of MVD. Using a tool like SqlLiteStudio, you will see the actual field definition order. I don't mean to confuse you on this. If I would have placed the actual field names as part of the SQL "Insert", it wouldn't have mattered about the field order. Just laziness on my part.


Here are the values for each field in the table:
1 = id
65280       = clLime color code for cdColorTextHRS
0               = clBlack color code for cdColorBgHRS
65280       = clLime color code for cdColorTextMINS
65280       = clLime color code for cdColorTextSECS
0               = clBlack color code for cdColorBgMINS
0               = clBlack color code for cdColorBgSECS
0               = clBlack color code for etColorBgHRS
0               = clBlack color code for etColorBgMINS
0               = clBlack color code for etColorBgSECS
16776960 = clAqua color code for etColorTextHRS
16776960 = clAqua color code for etColorTextMINS
16776960 = clAqua color code for etColorTextSECS
""              = Null value for SoundFile


Disabling/Enabling the Play and Stop buttons is good solution. I actually meant to do that for you. This will eliminate the need to intercept the error because the error should never occur because these buttons cannot be clicked when there is no sound file to play..

334

(28 replies, posted in General)

Adam,
I put the settings code in for you. I wasn't sure what the purpose is for the countUP table. I did not do anything with that. Maybe you were thinking of saving the last time entries. If so, I can put that together for you also, but I would probably put those entries in the settings file. The countUP table would not be necessary.


I put a Sounds folder in the project with a sound file in it for you to test the sound functionality. I also placed the color dialog picker in a function (GetColor) so the color dialog code does not need to be repeated for every selection. In addition I used a For loop to load the comboboxes in Form1 instead of hard coding all the entries. The result is the same. It's just less code and less typing.

335

(25 replies, posted in General)

Mathias - Good to know. Thanks for the info.


Adam - Here you go. Just click on the color panels in the Settings form to bring up the color dialog.


Edit - Found a small error. I re-uploaded a new project.

336

(25 replies, posted in General)

Adam,
See if this is acceptable.  I did not use the other forms. I just changed the properties of the main form (Form1). Also, it is not necessary to have an adjustment for the speed so I did nothing with the timer tab. I added a Colors table for looking up colors for the text and background.

337

(25 replies, posted in General)

Adam,
I'm running MVD 3.6 and it works fine. I ran your project "Stopwatch EHW 2.zip" with no problems. Did the version I submitted "Stopwatch New.zip" work at all for you?

338

(25 replies, posted in General)

Thank you Jean. Didn't know about DoubleBuffered either. I do not have a Delphi background and without real documentation, it can be sometimes difficult to know what can and cannot be done in MVD in certain situations. It's a good thing that this forum is here.


Adam, I downloaded your updated project, but I do not get any errors. Not sure what to tell you.

339

(25 replies, posted in General)

Up until I looked through the Delphi code shared by Adam I had no idea what GetTickCount was or how to use it. Now I know. So utilizing the code in the Delphi source, I put it together in MVD. Check it out. It was a learning experience for me so thanks for that.

340

(25 replies, posted in General)

Adam,
I've not ever done a project like this before, so I thought I would make an attempt at it. But I see Derek also put together something. Thanks Derek. Both are relatively close in concept and either technique could be used. I don't think there's ever just one way to skin a cat, so to speak.


But before you download and run, let me explain a couple of things. I tried to implement your split second counter (less than a second), but the calc and display of the tenths of a second slows the clock to the point where it becomes inaccurate. I tried to play with the interval, but without success.If it's changed to 100, it is way too slow. If it's changed to 93, it is too fast, If it's changed to 94, it is too slow. So the recommendation is to eliminate that part of the stopwatch and just use the seconds. It works fine and is accurate. I kept the display and script for the tenths of a second, but the script is commented. If you want to try it for yourself, then just uncomment the lines in the OnTimer procedure and change the interval to 100 or whatever. I think I have a commented line for that. Otherwise I would simply remove the display and script for it altogether.


I only placed the script for the first form (large display). I did not do anything with the other forms. I figured you could handle that.

341

(7 replies, posted in General)

Adam,
It looks like you are trying to sum the id instead of the salary.


Form1.GridEmployees.Columns[4].Footer.Caption := SQLExecute('SELECT SUM(id) FROM employees');

It should be

Form1.GridEmployees.Columns[4].Footer.Caption := SQLExecute('SELECT SUM(salary) FROM employees');

342

(2 replies, posted in General)

Adam,
You probably were getting the List Index Out of Bounds error because it looks like you were using the max col variable for your row loop and max row variable for your col loop. If all you want to do is color a specific col you can do the following:

procedure FORM2_TableGrid2_OnChange (Sender: string);
var iRow: integer;
begin
  for iRow := 0 to FORM2.TableGrid2.RowCount - 1 do
  begin
    FORM2.TableGrid2.Cell[1,iRow].Color := clYellow;     // This will color the entire second column in the tablegrid - No stripes
  end;
end;

For the empty dates, I had asked that same question a long time ago and Dimitry provided a workaround to trick the system for the date controls. Here it is:

if Form2.dtpMainPeopleDOB.Checked then Form2.dtpMainPeopleDOB.Format := ''
      else Form2.dtpMainPeopleDOB.Format := ' ';

You should place this on the form onShow event and then on the Form2.dtpMainPeopleDOB onChange event..

343

(11 replies, posted in General)

Not sure of another solution. The Alternate_Color procedure must know which tablegrid to work on, so something has to pass it on to it. Sorry I can't help you further.

344

(10 replies, posted in General)

Adam,
I'm not aware of an MVD command to close an external app. If there is one, maybe Dimitry can enlighten us with it.  In the meantime I revised the Splash project to use another approach. It seems a little awkward, but it works. The result is the splash form will disappear when the first form of the main app is displayed. I utilized the Sqlite.db in the splash app to store a message. I pass the splash app path to the main app in order to attach the database in the main app. When the main app opens the first form it will update the Sqlite.db in the splash app with the message of "Done". The splash app, using a one second timer, checks the message in the Sqlite.db. As soon as it sees "Done", then it closes the splash form.

345

(10 replies, posted in General)

Adam,
I took a slightly different approach, but still using a timer. Instead of having the splash screen in your main project. I created a splash screen only app which will immediately open the splash screen and immediately run your main project and then close the splash screen (and app) after seven seconds. I chose seven seconds because that is about the length of time it takes to load your main project outside of the MVD development environment. Obviously you can adjust the time as you see fit. For ease in uploading to the forum I placed your main project within the splash screen app folder.

346

(11 replies, posted in General)

See attached fix.

347

(3 replies, posted in General)

Sample project attached.

348

(6 replies, posted in General)

See attached. I created the Query button and I changed your script to click on the Query button when clicking on the main search button. Your search button is untouched.  I had to remove the backup folder and your database in order to upload here. You will need to copy your database back into the app folder before running.

349

(6 replies, posted in General)

Nitin ingale,

I'm not totally sure what "Total Sell" meant. Since the search dates were defined to the student as RegDate, I assumed that you wanted the total count of students for each course within the search dates. One of the problems you have is that id_CourseDB within the StudentDB is empty for every record. Therefore student records and course records are disconnected. I manually updated the id_CourseDB inside of studentDB for all students with a Regdate within September.(5 Records). I defined a query button on the right side of the form to do the selection. It summarizes (counts) all the students for each course.  I did not touch your search button in case I have totally misunderstood your issue. See if the attached is what you are looking for.


Well unfortunately I just found out that your project is too large to upload. Here is the SQL for the SQLQuery button I placed on the form:

Select a.CourseCode,a.CourseName,b.Field,Count(a.id),a.id From CourseDB a 
  Left Join Field b On b.id = a.id_Field 
  Left Join StudentDB c On c.id_CourseDB = a.id 
  Where Date(c.RegDate) >= Date({DateTimePicker1}) and Date(c.RegDate) <= Date({DateTimePicker2})
  Group By a.CourseCode 

You will need to update the id_CourseDB in StudentDB or this query will not work. Whatever form does the updating is not updating the id_CourseDB. That needs to be fixed.

You should setup calculated fields in your main table for the names. Something like the following:

(select name from tecnicos where tecnicos.id = message.id_tecnicos)

(select name from tecnicos where tecnicos.id = message.id_tecnicos1)

You can then place these calculated fields in your tablegrid settings.