Page 1 of 1

The Same code Mac Don't Go In Win..Why?

Posted: Sat Apr 02, 2016 12:11 pm
by LESTROSO
Hi to everybody,

Why the same code go in mac, but don't go in windows...the image button gadgets don't receive the clicks i think ...and block my program...

Here below i post a little portion of my code:

Code: Select all


IncludeFile "RD-Mac.pbf" 
Global numero1
Global numero2
Global risultato
Global test

numero1=0
numero2=0
risultato=0
test=0

UseJPEGImageDecoder()
UsePNGImageDecoder()

Img_RouletteD_0 =CatchImage(#PB_Any ,?sfondo)
Img_RouletteD_1=CatchImage(#PB_Any ,?ResetButton)
Img_RouletteD_2 =CatchImage(#PB_Any ,?Mano1)
Img_RouletteD_2 =CatchImage(#PB_Any ,?Mano2)
Img_RouletteD_4=CatchImage(#PB_Any,?Purelogo)
Img_RouletteD_3=CatchImage(#PB_Any,?Dollaro)




OpenRouletteD()

If LoadFont(0, "Times", 20)
  StringGadget(#Messaggi, 220, 20, 320, 90, "RD By Fasa 2016")
  
  SetGadgetFont(#Messaggi, FontID(0))   
EndIf



Repeat
 
  Event = WaitWindowEvent()
 
  Select Event
     
    Case #PB_Event_CloseWindow
      Quit = 1
                 
    Case #PB_Event_Gadget ; The Event that the window received
 
      If EventGadget() = #But1 
        
        If EventType() = #PB_EventType_LeftClick ; Is the type of Event a LeftClick ?
       
          If test=0
            HideGadget(DOLLARO1,0)
          If numero1=0
            numero1=1
          Else
             numero2= 1 
             If numero1<> 0
               If numero2<> 0
            Gosub ANALISI
                EndIf
                EndIf
                EndIf
              EndIf
              EndIf
                EndIf

EndSelect
Until Quit > 0


Can Somebody help me please????

Thanks a lot ,

lestroso :oops:

Re: The Same code Mac Don't Go In Win..Why?

Posted: Sat Apr 02, 2016 4:33 pm
by BasicallyPure
EventType() does not support events from buttons or buttonImage gadgets.
Remove this line and it should work.

Code: Select all

If EventType() = #PB_EventType_LeftClick ; Is the type of Event a LeftClick ?
If it works on Mac, that is by accident and not intended to work on all operating systems.

Read the help for EventType() and you will see that only the following gadgets are to be used with EventType().
Help wrote:The following gadgets support EventType():

- CanvasGadget() - The CanvasGadget has a special set of event types.
- ComboBoxGadget()
- DateGadget()
- EditorGadget()
- ExplorerListGadget()
- ExplorerTreeGadget()
- ImageGadget()
- ListViewGadget()
- ListIconGadget()
- MDIGadget()
- OpenGLGadget()
- SpinGadget()
- StringGadget()
- WebGadget() - The WebGadget has a special set of event types.

Re: The Same code Mac Don't Go In Win..Why?

Posted: Sun Apr 03, 2016 10:27 am
by mk-soft
No problem with "#PB_EventType_LeftClick" on Buttons or ImageButtons at all OS

Re: The Same code Mac Don't Go In Win..Why?

Posted: Sun Apr 03, 2016 10:42 am
by IdeasVacuum
LESTROSO, it's difficult for us to see what is happening because the code snippet cannot be run - RD-Mac.pbf and OpenRouletteD() and the Constants are missing (we can live without the images). Note that test = 0 is always true, so Gosub ANALISI is not executed. However, ANALISI should probably be a Procedure.

Code: Select all

numero1=0
numero2=0
risultato=0
test=0
These variables are zero when assigned, so the above code does nothing.