Found an issue in SpiderBasic ? Please report it here !
User avatar
Peter
 
Posts: 552
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

GadgetType() returns wrong values

by Peter Sun Oct 14, 2018 8:05 am

[posted by RSBasic in the german PureBasic-Forum]

Code: Select all
EnableExplicit

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_ScreenCentered)
  SpinGadget(1, 10, 10, 100, 20, 0, 100, 0)
 
  Debug GadgetType(1) ; Return value: 2 (2 = #PB_GadgetType_String)
  Debug #PB_GadgetType_Spin ; Return value: 26
 
EndIf

Code: Select all
EnableExplicit

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_ScreenCentered)
  DateGadget(1, 10, 10, 200, 20, "%dd.%mm.%yyyy", Date(), 0)
 
  Debug GadgetType(1) ; Return value: 2 (2 = #PB_GadgetType_String)
  Debug #PB_GadgetType_Date ; Return value: 21
 
EndIf
User avatar
Sicro
 
Posts: 1
Joined: Sat May 26, 2018 10:56 pm
Location: Germany

Re: GadgetType() returns wrong values

by Sicro Sun Oct 14, 2018 8:45 am

The same with the CalendarGadget.

Here's an all-in-one code:
Code: Select all
Enumeration
  #CalendarGadget
  #DateGadget
  #SpinGadget
EndEnumeration

If OpenWindow(0, 0, 0, 500, 400, "")
 CalendarGadget(#CalendarGadget, 0,  0, 500, 20)
 DateGadget(#DateGadget,         0, 21, 500, 20)
 SpinGadget(#SpinGadget,         0, 42, 500, 20, 1, 10)
 
 Debug "GadgetType(#CalendarGadget): " + Str(GadgetType(#CalendarGadget)) +
       "#PB_GadgetType_Calendar: " + Str(#PB_GadgetType_Calendar)
 
 Debug "GadgetType(#DateGadget):     " + Str(GadgetType(#DateGadget)) +
       "#PB_GadgetType_Date:     " + Str(#PB_GadgetType_Date)
 
 Debug "GadgetType(#SpinGadget):     " + Str(GadgetType(#SpinGadget)) +
       "#PB_GadgetType_Spin:     " + Str(#PB_GadgetType_Spin)
EndIf

The error is in the Javascript file "spiderbasic.js". In this code, the GadgetType values for the function "spider.gadget.register()" are wrong.
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download -- Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date
Return to Bugs Reports

Who is online

Users browsing this forum: No registered users and 2 guests