Page 1 of 1

Error with Tsbutton : Help !!!

Posted: Mon Jul 24, 2006 10:38 pm
by Silvio
U Know the sample child03(reservation bus) of the testbtn.prg of tsbutton ?

I must make a window where I can show many seats but I must use also a dbf to control if a seat is free or not.

I must create 20 seats for 8 lines ( 20x8) with tsbutton and write on it the number of the seat


I must create spaces betwen the seats and I use a for/next command to create the buttons


When I click on each seat the program must show me a menu popup near to button and then I can insert the reservation but I need the number of the seat to make it .

I hope U understand me
I hope U can help me ...


..
I explain you this sources:

Code: Select all

#include "fivewin.ch"

//#include "tsbutton.ch"


STATIC aBtn
Function test
Local oWnd,aBtn,totarray,n,fila

LOCAL OmbrxFila := 20
LOCAL FileOmbr := 8

local oFont ,oFont2  , oFont3

// configurazione 
   totarray :=  OmbrxFila*FileOmbr
   aBtn := Array(totarray)

n    := 1
fila := 60


DEFINE FONT oFont NAME "Ms Sans Serif"  SIZE 0, -10 BOLD

DEFINE FONT oFont2 NAME "Arial" SIZE 0,-16 BOLD
DEFINE FONT oFont3 NAME "Arial" SIZE 0,-10



DEFINE WINDOW  oWnd  COLOR GetSysColor(13), GetSysColor(1) ;
TITLE 'Visualizazzione '


FOR i := 1 TO FileOmbr
nPassLarg :=  0
col := 10
FOR k := 1 TO OmbrxFila

               cAction := "miazione("+Str(n)+")"
               bAction := {|| &cAction }
               bWhen   := {|| .T. }
               bValid  := {|| .T.  }
               cCaption := ""





@ Fila,(Col+nPassLarg) SBUTTON  aBtn[n] RESOURCE "omb3"   PIXEL;
               OF oWnd ;
               FONT oFont2 ;
               CAPTION cCaption ;
               COLOR CLR_WHITE, GetSysColor(15)  ;
               TEXT ON_CENTER ;
               NOBOX       ;
               TOOLTIP oemtoansi(cCaption) ;
               ACTION Miazione(aBtn[n])

                       col += 75
                    n++
                   // (oDCam)->(dbskip())
                    NEXT
                    fila +=75
                    NEXT






ACTIVATE WINDOW oWnd MAXIMIZED
return nil









  function miazione(n)
  Local oMenu, aRect ,nRow,nCol

  cpoltrona:= Val(aBtn[n]:cCaption)
    ?cpoltrona
     aRect := GetClientRect( aBtn:hWnd )

    MENU oMenu POPUP
         MENUITEM "&Nuova prenotazione"     action OCCUPARE(cpoltrona,.t.)
         MENUITEM "&Modifica prenotazione"  action OCCUPARE(cpoltrona,.f.)
         MENUITEM "&Mostra prenotazione"
      ENDMENU
      ACTIVATE POPUP oMenu AT aRect[ 3 ] + 1, aRect[ 2 ] OF  aBtn

      RETURN NIL




 FUNCTION OCCUPARE(cpoltrona,lnew)

   Local oDlg


       nmsgbox(cpoltrona)


return nil


why it not run ?

Help me

Regards