String gadget parameters from Windows to Linux

Linux specific forum
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

String gadget parameters from Windows to Linux

Post by harkon »

In my OpenWindow() routine I have the following string gadets (among others getting created)
These work well in Windows

StringGadget(#String_Desc, 250, 78, 370, 35, "", #PB_String_ReadOnly | #ES_MULTILINE|#ES_AUTOVSCROLL |#ESB_DISABLE_LEFT|#ESB_DISABLE_RIGHT)
StringGadget(#String_List, 300, 206, 160, 20, "", #PB_String_ReadOnly | #ES_CENTER)
StringGadget(#String_Mult, 361, 231, 30, 20, "", #PB_String_ReadOnly | #ES_CENTER)
StringGadget(#String_Sell, 300, 271, 160, 20, "", #PB_String_ReadOnly | #ES_CENTER)

Does anyone know how to get the same functionality in Linux. Specifically emulating the #ES constant functions?
Missed it by that much!!
HK
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Re: String gadget parameters from Windows to Linux

Post by Vera »

Hi harkon,

here's what I managed to workout so far: the alignment for the StringGadget and an alternative with an EditorGadget, as I didn't find a solution for the multiline-setting.
Further I have no clue what DISABLE_LEFT/RIGHT is meant to do.

Note: it's always better to post a running code, so people more likely jump in to give it a closer look and can more easily add or change what's needed.
In that sense :wink:

Code: Select all

; StringGadget - exchanging WIN-parameters with Linux-Api

ImportC ""
  gtk_entry_set_alignment(*entry.GtkEntry, xalign.f)             ; for the StringGadget
  gtk_adjustment_get_step_increment.d(*adjustment.GtkAdjustment) ; 3x for the EditorGadget scroll to bottom
  gtk_adjustment_get_upper.d(*adjustment.GtkAdjustment)
  gtk_adjustment_get_page_size.d(*adjustment.GtkAdjustment)
EndImport
Define *Adjustment.GtkAdjustment

If OpenWindow(0, 100, 150, 600, 300, "StringGadget - align & more to come", #PB_Window_SystemMenu)

Text$ = "Will these texts break into multiple lines ? ... text text text text text text text text text text text text text text text text text text text text text text text text text ... "

EditorGadget(0, 30, 12, 370, 85, #PB_Editor_ReadOnly); | #ES_MULTILINE|#ES_AUTOVSCROLL |#ESB_DISABLE_LEFT|#ESB_DISABLE_RIGHT)
SetGadgetText(0, Text$ + Text$+ Text$+ Text$) 

  gtk_text_view_set_left_margin_(GadgetID(0), 52)                     ; setting margins
  gtk_text_view_set_right_margin_(GadgetID(0), 52)
;  gtk_text_view_set_justification_(GadgetID(0), #GTK_JUSTIFY_CENTER) ; or o/w centered justification
 
  gtk_text_view_set_wrap_mode_(GadgetID(0), #GTK_WRAP_WORD)

  *Adjustment =gtk_scrolled_window_get_vadjustment_(gtk_widget_get_parent_(GadgetID(0)))
  *Adjustment\value=*Adjustment\upper
  gtk_adjustment_value_changed_(*Adjustment)

StringGadget(1, 50, 116, 370, 75, Text$, #PB_String_ReadOnly); | #ES_MULTILINE|#ES_AUTOVSCROLL |#ESB_DISABLE_LEFT|#ESB_DISABLE_RIGHT)
StringGadget(2, 100, 206, 160, 20, "text center", #PB_String_ReadOnly); | #ES_CENTER)
StringGadget(3, 150, 236, 160, 20, "text right", #PB_String_ReadOnly); | #ES_CENTER)
StringGadget(4, 200, 266, 160, 20, "text align a bit", #PB_String_ReadOnly); | #ES_CENTER)

	gtk_entry_set_alignment(GadgetID(1), 0.5)  ; Center
	gtk_entry_set_alignment(GadgetID(2), 0.5)
	gtk_entry_set_alignment(GadgetID(3), 1.0)  ; Right
	gtk_entry_set_alignment(GadgetID(4), 0.2)  ; 0.0 = Left

EndIf

Repeat
  Event = WaitWindowEvent()

  Select Event
    Case #PB_Event_CloseWindow
      Quit = #True
  EndSelect

Until Quit
greets ~ Vera

ps: checkout my sig below.
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: String gadget parameters from Windows to Linux

Post by harkon »

Thank you.
Missed it by that much!!
HK
Post Reply