It is currently Wed Sep 30, 2020 8:51 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Calendar gadget size fixed
PostPosted: Thu Feb 27, 2020 11:46 pm 
Offline
Addict
Addict

Joined: Mon Aug 04, 2008 10:56 pm
Posts: 1132
Location: Seattle, USA
It seems that no matter the x/y size of the CalendarGadget I get the same size of calendar and just extra space at the top and right of the calendar if I exceed the size below.

Code:
#calendarwnd=1
#calendar1=1

calendarx=138 ; change this size
calendary=149 ; change this size
xoffset=10
yoffset=10
wndx=xoffset+calendarx+xoffset
wndy=yoffset+calendary+yoffset

If OpenWindow(#calendarwnd,0,0,wndx,wndy, "Micro Calendar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CalendarGadget(#calendar1,xoffset,yoffset,calendarx,calendary)
EndIf

Repeat 
Until WaitWindowEvent() = #PB_Event_CloseWindow

_________________
MacBook Pro-r, OSX 10.14.6 , PB 5.70LTS


Last edited by WilliamL on Fri Feb 28, 2020 9:32 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Calendar gadget size fixed
PostPosted: Fri Feb 28, 2020 11:04 am 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2663
Location: Germany
I think we can't change the size of NSDatePicker... :(
Code:
;-TOP Dump Object Methods

; by mk-soft, 29.12.2019, v1.06

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
  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, #Null)
      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 = #False, HidePrivate = #True, ShowEncoding = #False, FirstArgument = 2)
  Protected r1.s, i, c, n, methodCount, Method.s
  Protected *Class, *Method, *Methods.udtArray
  Protected *String = AllocateMemory(1024)
 
  *Class = object_getclass_(*Object)
  If Super
    *Class = class_getsuperclass_(*Class)
    r1 = "SuperClass "
  Else
    r1 = "Class "
  EndIf
 
  *Methods = class_copyMethodList(*Class, @methodCount)
 
  r1 + PeekS(class_getName(*Class), -1, #PB_UTF8) + " - Count of Methods " + methodCount + #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
  Next
  r1 + "End Class" + #LF$
 
  free_(*methods)
  FreeMemory(*String)
 
  ProcedureReturn r1
EndProcedure

; ****

#calendarwnd=1
#calendar1=1

calendarx=238 ; change this size
calendary=230 ; change this size
xoffset=10
yoffset=10
wndx=xoffset+calendarx+xoffset
wndy=yoffset+calendary+yoffset

Define rect.cgrect
rect\size\width = 200.0
rect\size\height = 200.0

If OpenWindow(#calendarwnd,0,0,wndx,wndy, "Micro Calendar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CalendarGadget(#calendar1,xoffset,yoffset,calendarx,calendary)
  Debug DumpObjectMethods(GadgetID(#calendar1), 1)
  Debug "NSControl.controlSize = " + CocoaMessage(0, GadgetID(#calendar1), "controlSize")
  Debug "NSControl.sizeThatFits = " + CocoaMessage(0, GadgetID(#calendar1), "sizeThatFits:@", rect)
 
EndIf

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: Calendar gadget size fixed
PostPosted: Fri Feb 28, 2020 6:01 pm 
Offline
Addict
Addict

Joined: Mon Aug 04, 2008 10:56 pm
Posts: 1132
Location: Seattle, USA
Thanks for the reply mk-soft,

I couldn't decide if the Help info said the gadget could be resized or not. The spaces around the calendar were puzzling to me. Maybe change Help to...

(I think I posted a re-sizealble calendar many years ago)

_________________
MacBook Pro-r, OSX 10.14.6 , PB 5.70LTS


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye