Page 1 of 1

New User of FiveLinux

Posted: Mon Feb 11, 2013 9:50 pm
by Colin Haig
Hi All

I have just started my first venture into creating an application for Linux and have some questions ;

1 - How do I compile and link multiple prg files - the build.sh bat takes one prg file.

2 - Does anyone have a sample of a dialog with a few get controls - the tab key moves from one get to
the next but the get does not have focus and when you click on the get the cursor is in the wrong
position.
3 - In my windows apps I use the tDatabase class - the code for the class comes with FiveLinux - how can
I add it to the existing Libs.

Cheers

Colin

Re: New User of FiveLinux

Posted: Wed Feb 13, 2013 1:39 pm
by Antonio Linares
Colin,
1 - How do I compile and link multiple prg files - the build.sh bat takes one prg file.
You have to use a makefile. You can review the one that FiveLinux uses and adapt it to your needs:

http://code.google.com/p/fivelinux/sour ... k/Makefile

Re: New User of FiveLinux

Posted: Wed Feb 13, 2013 2:22 pm
by Antonio Linares
Colin,

This is a GETs example built using FiveLinux/samples/FiveForm.prg,

colin.prg

Code: Select all

#include "FiveLinux.ch"

//----------------------------------------------------------------------------//

function Main()

   local oForm1, oGet1, cGet1 := Space( 20 ), oGet2, cGet2 := Space( 20 ), oGet3, cGet3 := Space( 20 ), oBtn1, oBtn2

   DEFINE WINDOW oForm1 TITLE "Form1" ;
      SIZE 522, 314

   @  91, 111 GET oGet1 VAR cGet1 SIZE 200,  29 PIXEL OF oForm1

   @ 127, 113 GET oGet2 VAR cGet2 SIZE 200,  29 PIXEL OF oForm1

   @ 162, 114 GET oGet3 VAR cGet3 SIZE 200,  24 PIXEL OF oForm1

   @ 251, 174 BUTTON oBtn1 PROMPT "Button" ;
      SIZE 80, 30 PIXEL OF oForm1 ;
      ACTION MsgInfo( "Not defined yet!" )

   @ 250, 277 BUTTON oBtn2 PROMPT "Button" ;
      SIZE 80, 30 PIXEL OF oForm1 ;
      ACTION MsgInfo( "Not defined yet!" )

   ACTIVATE WINDOW oForm1 CENTERED

return oForm1

//----------------------------------------------------------------------------//
 

Re: New User of FiveLinux

Posted: Wed Feb 13, 2013 3:07 pm
by Antonio Linares
Colin,

We have just commited several changes to FiveLinux, in order to update it, please do this:

svn update fivelinux
make

samples/dbf01.prg is included now and it is already working fine :-)

Re: New User of FiveLinux

Posted: Thu Feb 14, 2013 2:03 am
by Colin Haig
Hi Antonio

A BIG thanks for your help.

I have compiled and linked fiveform.prg and when I try to run the program I get the
following error (unknown>:31267) Gtk- WARNING **: cannot open display :0.0

I used the same build.sh that I am using to build my app so the paths and libs etc should be okay.

I am still having the same problems with gets - the first get is okay but when you tab to the second get - it is filled with a solid color and when you type in a key the solid color disappears but the key entered is placed at where the sold color finished.

: test // first get
:######## // solid color second get
: test // color clears but test position wrong

On the plus side - tDatabase compiled and linked okay with my app and appears
to work fine.

Cheers

Colin

Re: New User of FiveLinux

Posted: Thu Feb 14, 2013 9:31 am
by Colin Haig
Hi Antonio

Here is a small code example to show the get problem

Code: Select all

#include "FiveLinux.ch"

function main()
local oWnd,oGet,Get1,cCode := space(5),cClient := space(15)

     DEFINE WINDOW oWnd ;
      SIZE 800,600
      
      
      @10,10 get oGet    VAR cCode SIZE 200,29 PIXEL of oWnd
      @60,10 get oGet1  VAR cClient SIZE 200,29 PIXEL of oWnd 
      
      
      ACTIVATE WINDOW oWnd CENTERED ;
          VALID MsgYesNo( "Are you sure ?" ) 
      
        
 return(nil)       

 
Cheers

Colin

Re: New User of FiveLinux

Posted: Thu Feb 14, 2013 10:52 am
by Antonio Linares
Colin,

Have you tried ./build.sh fiveform to build it from the samples folder ?

Going to review the GETs issue...

Re: New User of FiveLinux

Posted: Thu Feb 14, 2013 11:43 am
by Antonio Linares
Colin,

I have updated the Method GotFocus() in Class TGet to evaluate a bGotFocus if defined:

Code: Select all

METHOD GotFocus() CLASS TGet

   ::SetCurPos( ::oGet:pos - 1 )
   ::SetSel( 0, 0 )

   if ::bGotFocus != nil
      Eval( ::bGotFocus, Self )
   endif

return nil
so now we can do from the example:

oGet2:bGotFocus = { || oGet2:SetText( Time() ) }

with these tests I have found that the Methods SetCurPos() and SetSel() are not working from within the bGotFocus...

at least now we understand why that strange behavior is hapening

I have commited the changes to the repository in http://code.google.com/p/fivelinux/