It is currently Wed Jul 17, 2019 5:44 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: [PB5.70] Window of requesters doesn't show full title text
PostPosted: Thu Apr 11, 2019 11:15 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 622
Location: Portugal
Hello!

If I open a requester, the size of its window depends on the width of the text inside and doesn't respect the title text size.

If the title text is big and the inside text small, we get a bad looking requester too small.


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.70] Window of requesters doesn't show full title te
PostPosted: Thu Apr 11, 2019 1:13 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13595
Location: France
Please always post a small snippet, thank you.


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.70] Window of requesters doesn't show full title te
PostPosted: Thu Apr 11, 2019 3:52 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 622
Location: Portugal
@fred

Sorry...

Code:
MessageRequester("Version build data on website is outdated","Current Version:"+#LF$+"V"+current_version$+t$+#LF$+"Build: "+current_build$+#LF$+"Released: "+current_release_date$+#LF$+#LF$+"Site Version:"+#LF$+"V"+new_current_version$+" "+new_current_beta_final$+#LF$+"Build: "+new_current_build$+#LF$+"Released: "+new_current_release_date$+#LF$,#PB_MessageRequester_Warning)


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.70] Window of requesters doesn't show full title te
PostPosted: Thu Apr 11, 2019 4:20 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13595
Location: France
Seems like an OS limitation, we use standard requesters here


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.70] Window of requesters doesn't show full title te
PostPosted: Sat Apr 13, 2019 7:10 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 601
A simple 'hello' 'world' message fails to display correctly here.

But it can be done better:
Code:
EnableExplicit

#GTK_MESSAGE_OTHER = 4

Enumeration
  #GTK_ALIGN_FILL
  #GTK_ALIGN_START
  #GTK_ALIGN_END
  #GTK_ALIGN_CENTER
EndEnumeration

ImportC ""
   gtk_dialog_get_content_area_(dlg.i) As "gtk_dialog_get_content_area"
   gtk_header_bar_new_() As "gtk_header_bar_new"
   gtk_header_bar_set_has_subtitle_(header.i, sett.l) As "gtk_header_bar_set_has_subtitle"

   gtk_window_set_titlebar_(dialog.i, header.i) As "gtk_window_set_titlebar"
   gtk_header_bar_set_title_(header.i, title.p-utf8) As "gtk_header_bar_set_title"
   gtk_header_bar_set_decoration_layout_(header.i, layout.p-utf8) As "gtk_header_bar_set_decoration_layout"
   gtk_header_bar_set_show_close_button_(header.i, sett.l) As "gtk_header_bar_set_show_close_button"
   gtk_widget_set_halign_(wg.i, align.l) As "gtk_widget_set_halign"
   gtk_widget_set_valign_(wg.i, align.l) As "gtk_widget_set_valign"

   gtk_box_new_(ort.l, sp.l) As "gtk_box_new"
   gtk_image_set_from_icon_name_(img.i, name.p-utf8, size.l) As "gtk_image_set_from_icon_name"
   gtk_image_new_from_icon_name_(name.p-utf8, size.l) As "gtk_image_new_from_icon_name"
   gtk_image_set_pixel_size_(img.i, sz.l) As "gtk_image_set_pixel_size"
   gtk_message_dialog_get_message_area_(dialog.i) As "gtk_message_dialog_get_message_area"
   gtk_message_dialog_set_image_(dialog.i, img.i) As "gtk_message_dialog_set_image"
   
   gtk_widget_override_font_(wg.i, fd.i) As "gtk_widget_override_font"
   pango_font_description_set_weight_(font.i, weight.l) As "pango_font_description_set_weight"
EndImport

Procedure.l MsgBox(title.s, msg.s, flags.l = 0)
   CompilerIf #PB_Compiler_OS = #PB_OS_Linux
      Define.i dialog,header, win, hwin, childs, msgArea, label, hdrFont
      Define.l msgType, btnType, ret, dres
   
      ;icon
      If flags & #PB_MessageRequester_Info = #PB_MessageRequester_Info
         msgType = #GTK_MESSAGE_INFO
   
      ElseIf flags & #PB_MessageRequester_Warning = #PB_MessageRequester_Warning
         msgType = #GTK_MESSAGE_WARNING
   
      ElseIf flags & #PB_MessageRequester_Error = #PB_MessageRequester_Error
         msgType = #GTK_MESSAGE_ERROR
         
      Else
         msgType = #GTK_MESSAGE_OTHER
      EndIf
      
      ;button
      If flags & #PB_MessageRequester_YesNo = #PB_MessageRequester_YesNo
         btnType = #GTK_BUTTONS_YES_NO
   
      ElseIf flags & #PB_MessageRequester_YesNoCancel = #PB_MessageRequester_YesNoCancel
         btnType = #GTK_BUTTONS_YES_NO | #GTK_BUTTONS_CANCEL
         
      ElseIf flags & #PB_MessageRequester_Ok = #PB_MessageRequester_Ok
         btnType = #GTK_BUTTONS_OK
   
      Else
         btnType = #GTK_BUTTONS_OK
      EndIf
   
      win = GetActiveWindow()
      If win <> -1
         hwin = WindowID(win)
      EndIf
      dialog = gtk_message_dialog_new_(hwin,
                                       #GTK_DIALOG_MODAL | #GTK_DIALOG_DESTROY_WITH_PARENT,
                                       msgType,
                                       btnType,
                                       msg,
                                       0,
                                       0)
               
      ;Justify label text to the left           
      msgArea = gtk_message_dialog_get_message_area_(dialog)
      childs = gtk_container_get_children_(msgArea)
      label = g_list_nth_data_(childs, 0)
      gtk_widget_set_halign_(label, #GTK_ALIGN_START)
      
      If msgType = #GTK_MESSAGE_OTHER                         
         gtk_message_dialog_set_image_(dialog, 0)
      EndIf
      
      header = gtk_header_bar_new_()
      hdrFont = GetGadgetFont(#PB_Default)
      pango_font_description_set_weight_(hdrFont, 700) ;PANGO_WEIGHT_BOLD
      gtk_widget_override_font_(header, hdrFont)
      gtk_header_bar_set_has_subtitle_(header, 0)
      gtk_header_bar_set_show_close_button_(header, #True)
      gtk_header_bar_set_title_(header, title)
      gtk_window_set_titlebar_(dialog, header)
   
      gtk_widget_show_all_(dialog)
      
      dres = gtk_dialog_run_(dialog)
      Select dres
         Case #GTK_RESPONSE_OK, #GTK_RESPONSE_YES : ret = #PB_MessageRequester_Yes
         
         Case #GTK_RESPONSE_NO : ret = #PB_MessageRequester_No
         
         Case #GTK_RESPONSE_CANCEL : ret = #PB_MessageRequester_Cancel
   
         Default : ret = 0
      EndSelect
      
      gtk_widget_destroy_(dialog)
      
      ProcedureReturn ret
   
   CompilerElse
      ProcedureReturn MessageRequester(title, msg, flags)
   CompilerEndIf
EndProcedure

Define.s title, msg
Define.l ev

gtk_init_(0, 0)

title = "Version build data on website is outdated"
msg = "Version:" + #LF$ + "V" + "1.0" + #LF$ + "Build: "+ "123" + #LF$+ "Released: " + "2019" + #LF$ + #LF$ + "Site Version:" + #LF$ + "V" + "1.0" + " " + "1.0" + #LF$ + "Build: "+ "1.0" + #LF$ + "Released: " + "2019" + #LF$

; MessageRequester(title, msg, #PB_MessageRequester_Warning)
MsgBox(title, msg, #PB_MessageRequester_Warning)


Last edited by Justin on Sun Apr 14, 2019 7:25 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.70] Window of requesters doesn't show full title te
PostPosted: Sun Apr 14, 2019 11:52 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 601
Fixed to left align the message text.


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.70] Window of requesters doesn't show full title te
PostPosted: Sun Apr 14, 2019 7:26 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 601
Fixed bold font for message title.


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 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