Sign in Join
Wiki copytemporary

MSEide MSEgui Howto

English · Русский

Demos and examples

https://github.com/mse-org/mseuniverse/

Win32 Application Icon and Properties

1) Prepare the resource source files in the directory of your program:

File "version_data.rc":

pascal
1 VERSIONINFO
FILEVERSION 4,0,3,17
PRODUCTVERSION 3,0,0,0
FILEFLAGSMASK 0
FILEOS 0x40000
FILETYPE 1
{
 BLOCK "StringFileInfo"
 {
  BLOCK "040904E4"
  {
  VALUE "CompanyName","JSC TashkentP"
  VALUE "FileDescription","The main program file"
  VALUE "FileVersion","0.9a"
  VALUE "InternalName","ARM Podpiska"
  VALUE "LegalCopyright","JSC TashkentP’s property"
  VALUE "OriginalFilename","podpiska.pas"
  VALUE "ProductName","The program for ARM Podpiska"
  VALUE "ProductVersion","0.9a"
  }
 }
}

File "icon_data.rc":

text
 AppIcon ICON "app_icon.ico"

where "app_icon.ico" is 128x128 24bit ICO image. You may use any size at your favour (usually depends on preferable destop resolution/size) commonly greater or equal to 24x24 pixels.

My favorite editor to prepare such (and any kind of image) files is "Embellish".

2) From within Win-32 command shell, compile the prepared files with the supplied FPC resource compiler:

text
 # windres -O res -i version_data.rc -o version_data.res
 # windres -O res -i icon_data.rc -o icon_data.res

3) use the compiled resources in your application :

pascal
program super_puper;

{$ifdef FPC}{$mode objfpc}{$h+}{$INTERFACES CORBA}{$endif}
{$ifdef FPC}
 {$ifdef mswindows}
  {$apptype console}
 {$endif}
{$endif}
uses
 {$ifdef FPC}{$ifdef linux}cthreads,{$endif}{$endif}msegui,mseforms,
 main,dmmain,dmprint, dmacnt1, dmf18,dmrefs,
 connsetupform,mseconsts,mseconsts_ru,mseconsts_uzcyr;

// importing the compiled resources

{$ifdef mswindows}
 {$R version_data.res}
 {$R icon_data.res}
{$endif}

begin
 setlangconsts('ru');
 application.createdatamodule(tdmmainmo,dmmainmo);
 application.createdatamodule(tdmprintmo, dmprintmo);
 application.createdatamodule(tdmacnt1mo, dmacnt1mo);
 application.createdatamodule(tdmf18mo, dmf18mo);
 application.createdatamodule(tdmrefsmo, dmrefsmo);
 application.createform(tmainfo,mainfo);
 application.run;
end.

That's all at the moment.

Dynamic widget creation

To dynamically create a new widget (without using IDE), you need to do the following steps:

Here is an example of dynamically creating a tedit (for this code to work, you need to add dynedit: tedit; property declaration):

pascal
procedure tmainfo.mainformcreated(const sender: TObject);
begin
  dynedit := tedit.Create(self);
  dynedit.bounds_cx := 100;
  dynedit.bounds_cy := 21;
  dynedit.createframe;
  dynedit.frame.levelo := -2;
  insertwidget(dynedit, makepoint(300, 10));
  dynedit.show;
end;

If you need custom value for the face property, you can set it up as follows:

pascal
  dynedit.createface;
  with dynedit.face do begin
    fade_color.count := 2;
    fade_color[0] := cl_ltgreen;
    fade_color[1] := cl_dkgreen;
    fade_direction := gd_down;
  end;

From the Free Pascal wiki, page "MSEide MSEgui Howto", as it stood on 2023-07-20 after a change by Fredvs, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .

Edited on wiki.freepascal.org by 8 people, 2008–2023

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
Mse+ Win32 Application Icon and Properties
IvankobWin32 Application Icon and Properties
VincentWin32 Application Icon and Properties: fixed some quotes
Vincent
VincentText replace - "delphi>" to "syntaxhighlight>" (minor)
Chronos
FTurtle
TrevFixed syntax highlighting (minor)
TrevFix heading level (minor)
TrevAdd category (minor)
Mirror+dynamic widget creation (based on answers in http://freepascal.ru/forum/viewtopic.php?f=11&t=43228 and http://mseide-msegui-talk.13964.n8.nabble.com/MSEide-MSEgui-talk-Answer-to-msegui-Russian-forum-to-dyamically-create-a-frame-td2845.html )
FredvsFixed dynedit.face := tface.create(self); // otherwise memoryleak
MirrorDynamic widget creation: a better method to create frame and face, as suggested in http://mseide-msegui-talk.13964.n8.nabble.com/MSEide-MSEgui-talk-Answer-to-msegui-Russian-forum-to-dynamically-create-a-frame-and-a-face-td2845.html (minor)
FredvsDynamic widget creation: http://mseide-msegui-talk.13964.n8.nabble.com/MSEide-MSEgui-talk-Answer-to-msegui-Russian-forum-to-dynamically-create-a-frame-and-a-face-tp2845p2867.html
FredvsUndo revision 144235 by Fredvs (talk)
FredvsTips of Mirror to assign a visible frame
FredvsWin32 Application Icon and Properties

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.