Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. jjschwartz

    Auto-adjusting font size

    Thanks for the lead. I'm not sure how to determine if my text fits. As far as I can tell, a statictext (or a TLabel or a TEdit) doesn't have a canvas property. Also, this is multi-line text so I'm thinking I might have calculations I need to do to deal with the headers and footers and line...
  2. jjschwartz

    Auto-adjusting font size

    I am displaying various text in a statictext box. I don't want to use scroll bars or have it user-adjustable in any way. Sometimes the text is too much to fit into the statictext box. When this happens I would like to shrink the fontsize. I have no trouble adjusting the fontsize (I'm a...
  3. jjschwartz

    Faux copy protection

    I'm creating an application meant to be freely available to other University departments. I'm not interested in copy-protecting it per se, but I want to make sure that the attribution and credit are maintained. Right now, the splash screen, which is a .bmp, has all the credit information...
  4. jjschwartz

    Form position different on different machine

    (To TonHu) Yes the forms need to be exactly where I want them. Essentially, they're very graphical elements and I want it to look very uniform and pretty. Thanks to Buho. His solution is an excellent one. I've also learned that GetSystemMetrics(SM_CYCAPTION) can get similar information. I'm...
  5. jjschwartz

    Form position different on different machine

    I forgot one of the first rules of programming...when the program doesn't work right it's always the programmer's fault, not the compiler. I believe, if the menu bar and/or title bar of a form in XP style are taller than the menu bar and/or title bar of a form in Classic style, then that could...
  6. jjschwartz

    Form position different on different machine

    Excellent thought! Switching to classic view made the forms line up. So now I'm left with understanding why and how to deal with it. How can I check which appearance is in effect via Delphi? Why do I have to? "If appearance = xp then move the forms down" seems like such a kludge and it...
  7. jjschwartz

    Form position different on different machine

    I position many of my modal forms relative to the main form by setting their top and left properties relative to the main form. modalform.left := mainform.left + 100; modalform.top := mainform.top + 100; That way, my modal forms are always in the same position relative to the main form...
  8. jjschwartz

    Trouble showing Mpeg in window

    Curiously, if I set the MediaPlayer to display in a TPanel, it works fine. It's a problem only for an MPEG, with Wait=false, in a TEdit or TStaticText or TButton (at least that's all I've tried). I've rewritten my code to include a TPanel but I sure would like to understand why this happens.
  9. jjschwartz

    Trouble showing Mpeg in window

    I'm trying to show an Mpeg in an TEdit control on my form. My basic code is; procedure TForm1.Button1Click(Sender: TObject); begin MediaPlayer1.FileName := movie.mpeg; MediaPlayer1.Open; MediaPlayer1.Wait := false; MediaPlayer1.Play; end; where I've set the MediaPlayer1.Display property to...
  10. jjschwartz

    Unusual behavior from sleep()

    I'm trying to 'flash' a statictext label as an alert to the user. procedure form1.flash; begin statictext1.color := clBlack; statictext1.font.color := clWhite; beep; sleep(2000); end; (I've left out the restoring of the colors for this thread.) When this code runs, it beeps, the computer...
  11. jjschwartz

    Playing .wav from resource

    I'm trying to play a .wav file which is stored as a resource. Searching over the Internet, there seems to be two ways. One uses PlaySound(resourcename,0,SND_RESOURCE or SND_NODEFAULT), which seems real easy. The other uses SndPlaySound and involves finding, locking and freeing the resource...
  12. jjschwartz

    Why won't my modal form close?

    I've abstracted this problem to, hopefully, simplify it without losing the key elements. I have a project with 3 forms that are auto-created: Form1 (the main form), Form2 and Form3. Form1 has a button whose handler is: Form2.showmodal; Form2 has a button whose handler is: Form2.close...
  13. jjschwartz

    LoadFromFile from directory

    I want to loadfromfile several images that will be in the directory that the final compiled application will be in. But I won't know in advance what directory the user might place the application. Is there a way to have loadfromfile (and/or other directory-related functions) look in the...
  14. jjschwartz

    Where should procedures go

    Thanks much to buho and towerbase. I'm a preferred customer at amazon.com because I've purchased what seems like every book, in and out of print, on learning OOP and Delphi. OOP is coming along, albeit slowly. I'm very open to suggestions on best books or best approaches. Most of my books...
  15. jjschwartz

    Where should procedures go

    I'm having trouble understanding the scope of procedures and where they need to be declared. Suppose I have a form with a button and a label and I have the OnClick event of the button set to change the label caption. Now suppose I want to write some procedure outside the event handler to help...
  16. jjschwartz

    Structure of a unit/application

    Thank you for the advice but, as a Delphi newbie, I think I need a little more direction. What is a data module and how can I use it to store/use variables accesible to all my forms? Is it just a separate unit (like ProjConstants) that has the variables declared? I don't think creating a...
  17. jjschwartz

    Structure of a unit/application

    (Please bear with me; this is my first Delphi application) I have a number of constants and global variables (variables that all my forms will need access to) to declare. Where is the best place to do this? Can I put them in a separate unit and, if so, do I put the 'uses unit' in the project...
  18. jjschwartz

    Where should this code go?

    The first thing my application needs to do is open a text file and read its contents into a string array that, I believe, will need to be a global variable. Then my main form takes over and does all the interfacing and work. Where in the project should this initial reading of the file go? It...
  19. jjschwartz

    Making pretty forms

    I guess my language skills let me down. Let's see if my artistic skills are any better. I'd like my form to look something like this... ---------------------- <red><red><red> <red> LABEL <red> <red><red><red> <green><green><green> <green> EDITFIELD <green> <green><green><green>...
  20. jjschwartz

    Making pretty forms

    I'm trying to design a pretty form (yes, the best way to learn a language is to program a game). I'd like the labels/fields near the top to be on a blue background, near the middle to be on a red background, and near the bottom to be on a green background. I'm thinking of putting all the...

Part and Inventory Search

Back
Top