Search found 4 matches

by Alessandro777
Wed Feb 07, 2024 2:07 pm
Forum: Coding Questions
Topic: How to store and use a callback function (kind of delegate)
Replies: 3
Views: 4401

Re: How to store and use a callback function (kind of delegate)

Thank you these workarounds. I think they are interesting (I learnt a lot!) but are not so easy from maintenance and upgrade point of view.
I think SpiderBasic would need a datatype to manage procedures" (as the datatype "window" for example).
So...


structure TTest
myFunc.procedure
endstructure ...
by Alessandro777
Tue Feb 06, 2024 10:44 am
Forum: Coding Questions
Topic: How to store and use a callback function (kind of delegate)
Replies: 3
Views: 4401

How to store and use a callback function (kind of delegate)

Hello,

I wish to create a structure where I can store a point to a function, and call it when needed.
Example:


Structure TCalc
*addFunction
endstructure

procedure add(n1, n2)
procedurereturn (n1+n2)
endprocedure

theCalc.TCalc

theCalc\addFunction = @add()

;; FUNCTION CALL!

theCalc ...
by Alessandro777
Fri Feb 02, 2024 3:52 pm
Forum: Coding Questions
Topic: StringGadget() change font
Replies: 2
Views: 2187

Re: StringGadget() change font

Hello,

I tried your code but does NOT work for me. I tried in Opera Browser and Ms Edge but I get the same result:
https://i.ibb.co/jWPHRnL/Clipboard01.jpg

Just to show you the issue, I also added a TextGadget (and it works...).

Code:


If OpenWindow(0, 0, 0, 322, 80, "StringGadgets", #PB ...
by Alessandro777
Fri Feb 02, 2024 3:09 pm
Forum: Coding Questions
Topic: StringGadget() change font
Replies: 2
Views: 2187

StringGadget() change font

Hello,

it seems there is no way to change the font of a StringGadget. I use this code but has no effect (only font size changes):


Global FONT_MONOSPACE_16 = LoadFont(#PB_Any, "Courier", 16)

fldEmail = StringGadget(#PB_Any, 110, 10, 200, 25, "")
SetGadgetFont(fldEmail , FontID(FONT_MONOSPACE_16 ...