How to convert Delphi to Fivewin

How to convert Delphi to Fivewin

Postby Anderson.OL » Mon Oct 26, 2009 12:52 pm

How to convert?


Delphi
Code: Select all  Expand view
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, XPMan, StdCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    ProgressBar1: TProgressBar;
    XPManifest1: TXPManifest;
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

const
  PBS_MARQUEE = 8;
  PBM_SETMARQUEE = WM_USER + 10;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
   SetWindowLong(ProgressBar1.Handle, GWL_STYLE, GetWindowLong(ProgressBar1.Handle, GWL_STYLE) or PBS_MARQUEE);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
   SendMessage(ProgressBar1.Handle, PBM_SETMARQUEE, WPARAM(True), 100);
end;

end.
 


To Fivewin
Code: Select all  Expand view

#define PBS_MARQUEE  8
#define PBM_SETMARQUEE  WM_USER + 10
#define GWL_STYLE -16

function MsgRun( cCaption, cTitle, bAction )

   local oDlg, oMeter, oText, oBtn, oFont
   local nVal := 50, Result := .T.

   DEFAULT bAction  := { || nil },;
           cCaption := "Processando...",;
              cTitle   := "Por favor, aguarde..."

   DEFINE FONT      oFont           ;
             NAME      GetSysFont()    ;
             SIZE      0, -8

   DEFINE DIALOG    oDlg            ;
             FROM      5, 5 TO 10, 45  ;
             TITLE    cTitle          ;
             FONT     oFont
             
   oDlg:lHelpIcon := .F.
                                               
   @ 0.2, 0.5 SAY   oText           ;
           VAR       cCaption        ;
             SIZE      130, 10         ;
             OF        oDlg
             
   @ 1,   0.7 PROGRESS oMeter       ;
           POSITION  nVal            ;
             SIZE      150,10          ;
             OF        oDlg          

   // This block gets evaluated only the first time the DialogBox is painted !!!
   oDlg:bStart = { || SetWindowLong(oMeter:hWnd, GWL_STYLE, GetWindowLong(oMeter:hWnd, GWL_STYLE) .or. PBS_MARQUEE), Result := Eval( bAction) , oDlg:End() }
                     
   ACTIVATE DIALOG oDlg CENTERED ;
            on init (   SendMessage(oMeter:hwnd, PBM_SETMARQUEE, .T. , 10) )

   oFont:End()    

return Result


Error in line:
oDlg:bStart = { || SetWindowLong(oMeter:hWnd, GWL_STYLE, GetWindowLong(oMeter:hWnd, GWL_STYLE) .or. PBS_MARQUEE), Result := Eval( bAction), oDlg:End() }
FiveWin 9.03 + xHarbour !!
User avatar
Anderson.OL
 
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil

Re: How to convert Delphi to Fivewin

Postby Antonio Linares » Tue Oct 27, 2009 2:38 pm

Anderson,

Please make this change:

SetWindowLong(oMeter:hWnd, GWL_STYLE, nOr( GetWindowLong(oMeter:hWnd, GWL_STYLE), PBS_MARQUEE ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41351
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How to convert Delphi to Fivewin

Postby Anderson.OL » Tue Oct 27, 2009 7:32 pm

Almost worked. Not update when I run baction.


Code: Select all  Expand view

function MsgRun( cCaption, cTitle, bAction )

   local oDlg, oMeter, oText, oBtn, oFont
   local nVal := 90, Result := .T., oTmr := NIL


   DEFAULT bAction  := { || nil },;
           cCaption := "Processando...",;
              cTitle   := "Por favor, aguarde..."

   DEFINE FONT      oFont           ;
             NAME      GetSysFont()    ;
             SIZE      0, -8

   DEFINE DIALOG    oDlg            ;
             FROM      5, 5 TO 10, 45  ;
             TITLE    cTitle          ;
             FONT     oFont
             
   DEFINE Timer     oTmr            ;
          Of        oWnd             ;
             Interval  100             ;          
          Action    (SetWindowLong(oMeter:hWnd, GWL_STYLE, nOr( GetWindowLong(oMeter:hWnd, GWL_STYLE), PBS_MARQUEE )) ,;
                       oDlg:Refresh() )
             
   oDlg:lHelpIcon := .F.
                                   
   @ 0.2, 0.5 SAY   oText           ;
           VAR       cCaption        ;
             SIZE      130, 10         ;
             OF        oDlg
             
   @ 1,   0.7 PROGRESS oMeter       ;
           POSITION  nVal            ;
             SIZE      150,10          ;
             OF        oDlg          
   
   //oDlg:bStart = { || oTmr:Activate(), Result := Eval( bAction) , oDlg:End() }
   oDlg:bStart = { || oTmr:Activate() }

   ACTIVATE DIALOG   oDlg           ;
                CENTERED                ;              
            on init  SendMessage(oMeter:hwnd, PBM_SETMARQUEE, .T. , 100)
                         
   oTmr:Deactivate()
   oTmr:End()
   oTmr:= NIL

   oFont:End()    

return Result



English by Google.
FiveWin 9.03 + xHarbour !!
User avatar
Anderson.OL
 
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 25 guests