Hallo!
Kennt jemand eine Möglichkeit das TextGadget unter MacOs in einem anderen Winkel zu zeichnen?
vertikal, horizontal, oder am besten beliebig
TextGadget drehen?
TextGadget drehen?
Betriebssysteme: div. Windows, Linux, Unix - Systeme
no Keyboard, press any key
no mouse, you need a cat
no Keyboard, press any key
no mouse, you need a cat
Re: TextGadget drehen?
Habe was gefunden ... Es gibt aber verschiedene Möglichkeiten
- rotateByAngle: (0, 90, 180, 270)
Update
- setFrameRotation
- rotateByAngle: (0, 90, 180, 270)
Update
- setFrameRotation
Code: Alles auswählen
;-TOP Dump Object Methods
; by mk-soft, 29.12.2019 - 31.10.2021, v1.08.1
Structure udtArray
i.i[0]
EndStructure
ImportC ""
class_copyMethodList(*Class, *p_methodCount) ; -> An array of pointers of type Method describing
; the instance methods implemented by the class
; Any instance methods implemented by superclasses are Not included
; You must free the array with free()
class_getName(*Class) ; -> UnsafePointer<Int8> -> *string
sel_getName(*Selector) ; -> const char *
method_getName(*Method) ; -> Selector
method_getTypeEncoding(*Method) ; -> const char *
method_getReturnType(*Method, *dst, dst_len) ; -> void
method_getNumberOfArguments(*Method) ; -> unsigned int
method_getArgumentType(*Method, index, *dst, dst_len) ; -> void
NSGetSizeAndAlignment(*StringPtr, *p_size, *p_align) ; -> const char *
; Obtains the actual size and the aligned size of an encoded type.
EndImport
; ----
Procedure.s GetArgumentType(*String)
Protected r1.s, arg.s, size.i, ofs.i
arg = PeekS(*String, -1, #PB_UTF8)
r1 + arg + " - "
If Left(arg, 1) = "^"
r1 + "A pointer to type of "
arg = Mid(arg, 2)
EndIf
Select arg
Case "c" : r1 + "A char "
Case "i" : r1 + "An int "
Case "s" : r1 + "A short "
Case "l" : r1 + "A long "
Case "q" : r1 + "A long long"
Case "C" : r1 + "An unsigned char "
Case "I" : r1 + "An unsigned int "
Case "S" : r1 + "An unsigned short "
Case "L" : r1 + "An unsigned long "
Case "Q" : r1 + "An unsigned long long "
Case "f" : r1 + "A float "
Case "d" : r1 + "A double "
Case "B" : r1 + "A C++ bool Or a C99 _Bool "
Case "v" : r1 + "A void"
Case "*" : r1 + "A character string (char *) "
Case "@" : r1 + "An object (whether statically typed Or typed id) "
Case "#" : r1 + "A class object (Class) "
Case ":" : r1 + "A method selector (SEL) "
Default:
NSGetSizeAndAlignment(*String, @size, @ofs)
r1 + "[" + Str(size) + " bytes]"
EndSelect
If Right(arg, 1) = "?"
r1 + "An unknown type (e.g. function pointer)"
EndIf
ProcedureReturn r1
EndProcedure
; ----
Procedure.s DumpObjectMethods(*Object, Super = 0, HidePrivate = #True, ShowEncoding = #False, FirstArgument = 2)
Protected r1.s, i, c, n, methodCount, Method.s
Protected *Class, *SuperClass, *Method, *Methods.udtArray
Protected *String = AllocateMemory(1024)
*Class = object_getclass_(*Object)
r1 + PeekS(class_getName(*Class), -1, #PB_UTF8)
If Super
For i = 1 To Super
*SuperClass = class_getsuperclass_(*Class)
If *SuperClass
*Class = *SuperClass
r1 + " -> " + PeekS(class_getName(*Class), -1, #PB_UTF8)
Else
Break
EndIf
Next
EndIf
*Methods = class_copyMethodList(*Class, @methodCount)
r1 + #LF$ + #LF$ + "Count of Methods: " + methodCount + #LF$ + #LF$
For i = 0 To methodCount - 1
*Method = *Methods\i[i];
Method = PeekS(sel_getName(method_getName(*Method)), -1, #PB_UTF8)
If HidePrivate And Left(Method, 1) = "_"
Continue
EndIf
r1 + "Method " + Method + #LF$
If ShowEncoding
r1 + " * Encoding " + PeekS(method_getTypeEncoding(*Method), -1, #PB_UTF8) + #LF$
EndIf
method_getReturnType(*Method, *String, 1024)
r1 + " -- ReturnType = " + GetArgumentType(*String) + #LF$
c = method_getNumberOfArguments(*Method)
For n = FirstArgument To c - 1
method_getArgumentType(*Method, n, *String, 1024)
r1 + " -- Argument " + Str(n - FirstArgument + 1) + " = " + GetArgumentType(*String) + #LF$
Next
r1 + #LF$
Next
r1 + "End Class" + #LF$
free_(*methods)
FreeMemory(*String)
ProcedureReturn r1
EndProcedure
; ****
;-TOP
#ProgramTitle = "Main Window"
#ProgramVersion = "v1.01.0"
Enumeration Windows
#Main
EndEnumeration
Enumeration MenuBar
#MainMenu
EndEnumeration
Enumeration MenuItems
EndEnumeration
Enumeration Gadgets
#MainText
#MainText2
EndEnumeration
Enumeration StatusBar
#MainStatusBar
EndEnumeration
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(#Main)
dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar); - MenuHeight()
; Resize gadgets
EndProcedure
Procedure Main()
Protected dx, dy
Protected dblVal.d
#MainStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
If OpenWindow(#Main, #PB_Ignore, #PB_Ignore, 800, 600, #ProgramTitle , #MainStyle)
; Menu
CreateMenu(#MainMenu, WindowID(#Main))
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
; Enable macOS Menu About and Preferences
MenuItem(#PB_Menu_About, "")
MenuItem(#PB_Menu_Preferences, "")
; Rename Menu Entry
; SetMenuItemText(#MainMenu, #PB_Menu_About, "Über " + GetFilePart(ProgramFilename(), #PB_FileSystem_NoExtension))
; SetMenuItemText(#MainMenu, #PB_Menu_Preferences, "Einstellungen")
CompilerEndIf
; StatusBar
CreateStatusBar(#MainStatusBar, WindowID(#Main))
AddStatusBarField(#PB_Ignore)
; Gadgets
dx = WindowWidth(#Main)
dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar); - MenuHeight()
TextGadget(#MainText, 00, 00, 200, 200, "NSView rotateByAngle", #PB_Text_Border)
TextGadget(#MainText2, 200, 200, 200, 40, "NSView setFrameRotation ", #PB_Text_Border | #PB_Text_Center)
; Test
dblVal = 270.0
CocoaMessage(0, GadgetID(#MainText), "rotateByAngle:@", @dblVal)
dblVal = 60.0
CocoaMessage(0, GadgetID(#MainText2), "setFrameRotation:@", @dblVal)
; Bind Events
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), #Main)
Debug DumpObjectMethods(GadgetID(#MainText), 3)
; Event Loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case #Main
Break
EndSelect
Case #PB_Event_Menu
Select EventMenu()
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
Case #PB_Menu_About
MessageRequester("About", #ProgramTitle + #LF$ + #ProgramVersion, #PB_MessageRequester_Info)
Case #PB_Menu_Preferences
Case #PB_Menu_Quit
PostEvent(#PB_Event_CloseWindow, #Main, #Null)
CompilerEndIf
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ForEver
EndIf
EndProcedure : Main()
Alles ist möglich, fragt sich nur wie...
Projekte ThreadToGUI / EventDesigner V3 / OOP-BaseClass-Modul
Downloads auf MyWebspace / OneDrive
Projekte ThreadToGUI / EventDesigner V3 / OOP-BaseClass-Modul
Downloads auf MyWebspace / OneDrive
Re: TextGadget drehen?
Das ist genial!
Vielen Dank für die Mühe.
Wieder etwas für die nützliche Mac-API-Bibliothek für PureBasic.
Anbei:
Das mit "rotateByAngle" innerhalb einer Cocoa-Message hatte ich auch mal kurz ausprobiert, aber falsch angewendet.
Ich wäre aber wahrscheinlich auch noch dahinter gekommen.
Du warst aber schneller.
In Verbindung mit einem PureBasic-Canvas_Container (#PB_Canvas_Container) funktioniert das für scharfe Schriften ziemlich gut mit einem TextGadget.
Vielen Dank für die Mühe.
Wieder etwas für die nützliche Mac-API-Bibliothek für PureBasic.
Anbei:
Das mit "rotateByAngle" innerhalb einer Cocoa-Message hatte ich auch mal kurz ausprobiert, aber falsch angewendet.
Ich wäre aber wahrscheinlich auch noch dahinter gekommen.
Du warst aber schneller.
In Verbindung mit einem PureBasic-Canvas_Container (#PB_Canvas_Container) funktioniert das für scharfe Schriften ziemlich gut mit einem TextGadget.
Betriebssysteme: div. Windows, Linux, Unix - Systeme
no Keyboard, press any key
no mouse, you need a cat
no Keyboard, press any key
no mouse, you need a cat