Share your advanced knowledge/code with the community.
falsam
 
Posts: 259
Joined: Mon May 05, 2014 9:49 pm
Location: France

Re: Extending the Debug-Window

by falsam Thu Feb 15, 2018 3:39 pm

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);
! }

➽ Windows 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

Sorry for my poor english
User avatar
Peter
 
Posts: 486
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

Re: Extending the Debug-Window

by Peter Thu Feb 15, 2018 4:38 pm

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.php?p=5111#p5111

Greetings ... Peter
User avatar
Peter
 
Posts: 486
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

Re: Extending the Debug-Window

by Peter Sat Feb 17, 2018 12:50 pm

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
karu
 
Posts: 40
Joined: Mon Feb 24, 2014 10:16 pm

Re: Extending the Debug-Window

by karu Wed Feb 21, 2018 11:11 am

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
Return to Tricks 'n' Tips

Who is online

Users browsing this forum: No registered users and 1 guest