Page 2 of 2

Re: Extending the Debug-Window

Posted: Thu Feb 15, 2018 3:39 pm
by falsam
Thanks, Peter, but it doesn't work with this erroneous code.

Code: Select all

SetConsole(#myConsole)

! try {
!initProcess()
!var process = New PROCESS 

! } catch (err) {
!   console.error(err);
! }

Re: Extending the Debug-Window

Posted: Thu Feb 15, 2018 4:38 pm
by Peter
falsam wrote:

Code: Select all

!var process = New PROCESS
i don't think that you can catch uncaught SyntaxErrors. Image I have to investigate...

in the meantime you can take a look at my updated code (now there is no try-catch-block needed anymore): http://forums.spiderbasic.com/viewtopic ... 5111#p5111

Greetings ... Peter

Re: Extending the Debug-Window

Posted: Sat Feb 17, 2018 12:50 pm
by Peter
Peter wrote:i don't think that you can catch uncaught SyntaxErrors. Image I have to investigate...
in principle it seems to be possible (see this JsFiddle), but I have no idea how to implement it with SpiderBasic...

Greetings ... Peter

Re: Extending the Debug-Window

Posted: Wed Feb 21, 2018 11:11 am
by karu
Peter wrote:
karu wrote:Now working
i'm glad to read that it was solved.
karu wrote:Please advice, how i can put similar button also to other windows, thaks :roll:
Image

Code: Select all

Procedure AddWindowGadget(Window, Gadget)
  
  If IsWindow(Window) = 0 : ProcedureReturn : EndIf
  If IsGadget(Gadget) = 0 : ProcedureReturn : EndIf
  
  Protected WID = WindowID(Window)
  Protected GID = GadgetID(Gadget)
  
  ! $(v_gid.div).css("right", $(v_gid.div).css("left"));
  ! $(v_gid.div).css("left", "");
  
  ! $(v_gid.div).appendTo(v_wid.title);
  
EndProcedure

Enumeration
  #myWindow
  #myButton1
  #myButton2
EndEnumeration

Procedure myButton1Event()
  Debug "myButton1Event()"
EndProcedure

Procedure myButton2Event()
  Debug "myButton2Event()"
EndProcedure

OpenWindow(#myWindow, #PB_Ignore, #PB_Ignore, 300, 300, "Window", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget)

ButtonGadget(#myButton1, 64, 4, 22, 22, "!") ; Please note, that the X-Position of the button is the Right-Position in the titlebar!
GadgetToolTip(#myButton1, "This is button 1")
AddWindowGadget(#myWindow, #myButton1)
BindGadgetEvent(#myButton1, @myButton1Event())

ButtonGadget(#myButton2, 40, 4, 22, 22, "?") ; Please note, that the X-Position of the button is the Right-Position in the titlebar!
GadgetToolTip(#myButton2, "This is button 2")
AddWindowGadget(#myWindow, #myButton2)
BindGadgetEvent(#myButton2, @myButton2Event())
Greetings ... Peter
Thaks Perer, can you show how code with only one button (now beetween one button and close button empty space) and if there possible to use flat buttos (like in the beginning of the topic) with my custom image, thanks?

Karu