On each button I action a menu pop to create a reservation of a seat
- Code: Select all Expand view
bAction := {|oBtn| prenotamenu( oBtn ) ,oBtn:cCaption := "",oBtn:Disable( VK_RBUTTON ), oBtn:Refresh() }
this is the popmenu
- Code: Select all Expand view
Static Function prenotamenu( oBtn )
Local oMenu, aRect
aRect := GetClientRect( oBtn:hWnd )
MENU oMenu POPUP
MENUITEM "&Nuova prenotazione" ACTION prenota( oBtn,.t. )
MENUITEM "&Modifica prenotazione" ACTION prenota( oBtn,.f. )
SEPARATOR
MENUITEM "&Mostra prenotazione" ACTION prenota( oBtn )
ENDMENU
ACTIVATE POPUP oMenu AT aRect[ 3 ] + 1, aRect[ 2 ] OF oBtn
Return Nil
when I run prenota function the procedure must modify the seat bitmap if I insert the reservation but the procedure modify the seat bitmap if I insert or I not Insert .
this is the code of prenota ()
- Code: Select all Expand view
Static Function prenota( oBtn,lnew )
Local cNumero := oBtn:Cargo
Local atipo :={"Autorità","Riservato","Docente","Alunno","Genitore","Esterno"}
Local Prenotato := .F.
Local Pagato := .F.
local lReg := .f.
LOCAL aDat[10]
LOCAL oget1,oget2
LOCAL tipo
IF lNew
aDat[ 1]:=Space(40)
aDat[ 2]:=Space(40)
aDat[ 3]:=.f.
aDat[ 4]:=0
ELSE
aDat[ 1]:= teatro->nominativo
aDat[ 2]:= teatro->tipo
aDat[ 3]:= teatro->pagato
aDat[ 4]:= teatro->biglietto
endif
DEFINE DIALOG oDlg RESOURCE "prenota";
TITLE "ESEMPIO DI Prenotazione poltrona numero : "+cNumero
REDEFINE GET aDat[ 1] ID 101 OF oDlg PICTURE "@!"
REDEFINE COMBOBOX aDat[2] ITEMS aTipo ID 102 OF oDlg
REDEFINE CHECKBOX aDat[3] ID 301 OF oDlg
REDEFINE GET aDat[4] ID 103 OF oDlg PICTURE "999999999.99"
REDEFINE BUTTON ID 104 OF oDlg ACTION (lReg:=.T.,oDlg:End())
REDEFINE BUTTON ID 105 OF oDlg ACTION oDlg:End() CANCEL
ACTIVATE DIALOG oDlg
IF lReg
nMSGBOX("Salvataggio Prenotazione","Informazioni")
oBtn:Enable()
oBtn:cCaption := oBtn:Cargo
oBtn:Refresh()
else
endif
return nil
How I must make to show the seat modified only when I insert the reservation ?