BorisTheOld wrote:In the great scheme of things, customers don't worry about a few extra machine cycles or how pretty the screen looks.
Do your applications use windows and gadgets to communicate with your users or are they only doing calculations in the background? As soon as you present PB gadgets in your forms you might run into trouble. Did you never need some pretty elementary tasks like to justify text in table columns (ListIconGadget), center text in a StringGadget or display tree items with icons or check boxes (in PB's MacOS version icons and check boxes can only be displayed at the left edge of the TreeGadget: API-workaround) and many more (take a look into my cross-platform examples). For these tasks I needed to use API functions on some or all of the 3 OS platforms and in most cases there doesn't exist a non-API way. Or do you sacrifice a user friendly GUI only in order to not having to use API?BorisTheOld wrote:But never have I found it desirable to make API calls from high-level languages.
You have already presented examples of your code which consists of thousands of modules. Why should it be so hard to also put API code into modules and change these modules as soon as the missing functionality is implemented natively in PureBasic?
Sorry for hijacking this thread. As a compensation I have taken PB's example code and added the API parts for Linux and MacOS...
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
ImportC ""
gtk_button_set_alignment(*Button.GtkButton, xAlign.F, yAlign.F)
EndImport
CompilerEndIf
OpenWindow(0,200,200,200,100,"test")
ButtonGadget(0,10,10,180,80,"Click for left")
bg=GadgetID(0)
t=1
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget
t=1-t
If t=0
SetGadgetText(0,"Click for center")
Else
SetGadgetText(0,"Click for left")
EndIf
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Linux
gtk_button_get_alignment_(bg, @xAlign.F, @yAlign.F)
gtk_button_set_alignment(bg, Abs(xAlign - 0.5), yAlign)
CompilerCase #PB_OS_MacOS
CocoaMessage(0, bg, "setAlignment:", CocoaMessage(0, bg, "alignment") ! 1)
CompilerCase #PB_OS_Windows
SetWindowLongPtr_(bg,#GWL_STYLE,GetWindowLongPtr_(bg,#GWL_STYLE)!#BS_LEFT)
CompilerEndSelect
EndIf
Until ev=#PB_Event_CloseWindow