Problem with User Defined Function - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: Problem with User Defined Function (/showthread.php?tid=547) |
Problem with User Defined Function - RNBW - 06-13-2022 When I try to compile this snippet Code: (Select All) Type ButtonT ------------------------ Expected ) Caused by (or after): Line 9: Function Button_New(x As Integer, y As Integer, w As Integer, h As Integer, Text As String) As Button ------------------------ Can someone clarify what I am doing wrong. RE: Problem with User Defined Function - bplus - 06-13-2022 Code: (Select All) Function Button(x As Integer, y As Integer, w As Integer, h As Integer, Text As String) As ButtonT "As Button" on end is trying to make a Function return a ButtonT. As I said in Simple GIU thread, QB64 Functions can not return UDT's like FreeBasic can. It's not a simple translation from FB because, again, FB can do UDT arrays and Functions can return UDT's neither of which QB64 can do directly. You'd have to change it to a sub and "output" the btn in the parameters: Code: (Select All) Type ButtonT RE: Problem with User Defined Function - RNBW - 06-14-2022 @bplus Yes, that's solved it. |