Le forum (ô combien francophone) des utilisateurs de Powerbuilder.
J'aimerai savoir s'il y avait une possibilité de scindé la MicroHelp
Par exemple mettre l'heure d'un coté
l'aide du menu de l’autre,
le temps de connexion au milieu ….
Merci
Hors ligne
y a moyen mais c'est un peu du bricolage, néanmoins le résultat est correct donc pourquoi pas ?
Voilà un exemple de comment faire :
Putting Time On The Right Side Of MDI Microhelp
POWERBUILDER FAXBACK DOCUMENT 2034
// this combination of scripts will allow you to display the time on // the right side of mdi microhelp. it uses pop-up window that contains // a single line edit. the sle displays the time. the pop-up window is // placed on the mdi frame over the microhelp, and is moved whenever // the frame moves or is resized. // // instance variables for the mdi frame integer ox,oy,oh,ow // old x,y and height, width w_popup lpop // local popup which traipes ... // end instance variables for mdi frame // Open event for w_MDI_frame integer wx,wy,wh,ww // workspace extents ox=this.x oy=this.y oh=this.height ow=this.width wx=this.workspacex ( ) wy=this.workspacey ( ) wh=this.workspaceheight ( ) ww=this.workspacewidth ( ) open(lpop) move(lpop,wx+ww - lpop.width - 15,wy+wh - lpop.height - 22) show(lpop) //Resize event for w_MDI_frame integer wx,wy,wh,ww wx=this.workspacex ( ) wy=this.workspacey ( ) wh=this.workspaceheight ( ) ww=this.workspacewidth ( ) if ( handle (lpop) > 0 ) then move(lpop,wx+ww - lpop.width - 15,wy+wh - lpop.height - 22) end if SetFocus(this) // User event for pbm_move for w_MDI_frame integer wx,wy,wh,ww wx=this.workspacex ( ) wy=this.workspacey ( ) wh=this.workspaceheight ( ) ww=this.workspacewidth ( ) if ( handle (lpop) > 0 ) then move(lpop,wx+ww - lpop.width - 15,wy+wh - lpop.height - 22) end if SetFocus(this) // Open event for w_popup sle_time.weight = 300 Timer(5) triggerevent(this,timer!) //Timer event for w_popup Time t t=now() sle_time.hide ( ) //hide the sle sle_time.text=space(len(sle_time.text)) sle_time.text=string(hour(t))+":"+& string(Minute(t))+":"+string(Second(t)) sle_time.show ( ) //re-show the sle
Hors ligne
Merci Mais
Je viends de le faire c'est pas genial ... c'est vraiment du bricolage ....
Hors ligne
Il reste la solution de créer une microhelp spécifique, mais c'est beaucoup de boulot et il faut obligatoirement la raccorder à l'objet ancêtre de ta mdihelp (C'est ce qui a été fait chez mon client: ils ont un framework spécifique avec ce genre de "joujou")
Hors ligne
voici le code en pb10
fenetre : w_statusbar
forward global type w_statusbar from window end type type st_message_border from statictext within w_statusbar end type type st_date_border from statictext within w_statusbar end type type st_time_border from statictext within w_statusbar end type type ln_far_left from line within w_statusbar end type type st_time from statictext within w_statusbar end type type st_date from statictext within w_statusbar end type type st_message from statictext within w_statusbar end type end forward global type w_statusbar from window integer width = 905 integer height = 72 boolean border = false windowtype windowtype = child! long backcolor = 79741120 st_message_border st_message_border st_date_border st_date_border st_time_border st_time_border ln_far_left ln_far_left st_time st_time st_date st_date st_message st_message end type global w_statusbar w_statusbar type prototypes Function integer GetClassName ( & ulong hWind, & Ref string name, & int cbmax & ) Library "user32.dll" Alias For "GetClassNameW" Function ulong GetWindow ( & ulong hWind, & uint fuRel & ) Library "user32.dll" Function ulong SetParent ( & ulong hChild, & ulong hParent & ) Library "user32.dll" end prototypes type variables window iw_frame String is_classname Integer ii_width Long il_temps_connection end variables forward prototypes public subroutine wf_set_message (string as_msg) public subroutine wf_reposition () public subroutine wf_setparent () end prototypes public subroutine wf_set_message (string as_msg);//// set message //st_message.text = " " + Trim(as_msg) // //// update date/time //this.Event Timer() end subroutine public subroutine wf_reposition ();Integer li_share // if the window would be more than 2/3 // of width hide it off to the right li_share = (iw_frame.width / 3) * 2 If this.ii_width > li_share Then this.x = iw_frame.width Else If iw_frame.WindowState = Maximized! Then this.x = iw_frame.width - ii_width - 25 Else this.x = iw_frame.width - ii_width - 90 End If End If this.y = 5 // update date/time //this.Event Timer() end subroutine public subroutine wf_setparent ();String ls_name ULong lul_hwnd Integer li_rc // find the microhelp handle lul_hwnd = GetWindow(Handle(iw_frame), 5) DO UNTIL lul_hwnd = 0 ls_name = Space(25) li_rc = GetClassName(lul_hwnd, ls_name, Len(ls_name)) If ls_name = is_classname Then lul_hwnd = SetParent(Handle(this), lul_hwnd) lul_hwnd = 0 Else lul_hwnd = GetWindow(lul_hwnd, 2) End If LOOP end subroutine on w_statusbar.create this.st_message_border=create st_message_border this.st_date_border=create st_date_border this.st_time_border=create st_time_border this.ln_far_left=create ln_far_left this.st_time=create st_time this.st_date=create st_date this.st_message=create st_message this.Control[]={this.st_message_border,& this.st_date_border,& this.st_time_border,& this.ln_far_left,& this.st_time,& this.st_date,& this.st_message} end on on w_statusbar.destroy destroy(this.st_message_border) destroy(this.st_date_border) destroy(this.st_time_border) destroy(this.ln_far_left) destroy(this.st_time) destroy(this.st_date) destroy(this.st_message) end on event open;boolean lb_find iw_frame = This.ParentWindow() Do While (Not IsNull(iw_frame)) And (Not lb_find) If Not iw_frame.WindowType = MdiHelp! Then iw_frame = iw_frame.ParentWindow() Else lb_find = True End If Loop If Not lb_find Then Close(This) Else Environment le_env GetEnvironment(le_env) il_temps_connection = 0 // determine position of window within microhelp bar ii_width = st_time.x + st_time.width + 25 this.width = ii_width // set object class name If le_env.PBMajorRevision = 10 And & le_env.PBMinorRevision = 5 Then // PowerBuilder 10.5 is_classname = "FNHELP105" Else is_classname = "FNHELP" + & String(le_env.PBMajorRevision * 10) End If // set parenthood this.wf_setparent() // position the window this.wf_reposition() // initiate timer Timer(1) End if end event event timer;// set current time st_time.text = String(Now(), "hh:mm:ss") // set current date st_date.text = String(Today(), "dd/mm/yyyy") il_temps_connection = il_temps_connection +1 st_message.text = string(truncate(il_temps_connection/60,0),'00') +' : ' + string(mod(il_temps_connection,60),'00') end event type st_message_border from statictext within w_statusbar integer x = 14 integer y = 4 integer width = 297 integer height = 64 integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 long backcolor = 67108864 boolean enabled = false boolean border = true borderstyle borderstyle = stylelowered! boolean focusrectangle = false end type type st_date_border from statictext within w_statusbar integer x = 320 integer y = 4 integer width = 311 integer height = 64 integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 long backcolor = 67108864 boolean enabled = false boolean border = true borderstyle borderstyle = stylelowered! boolean focusrectangle = false end type type st_time_border from statictext within w_statusbar integer x = 635 integer y = 4 integer width = 256 integer height = 64 integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 long backcolor = 67108864 boolean enabled = false boolean border = true borderstyle borderstyle = stylelowered! boolean focusrectangle = false end type type ln_far_left from line within w_statusbar long linecolor = 16777215 integer linethickness = 4 integer beginy = 4 integer endy = 68 end type type st_time from statictext within w_statusbar integer x = 640 integer y = 8 integer width = 242 integer height = 56 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long backcolor = 79741120 alignment alignment = center! boolean focusrectangle = false end type type st_date from statictext within w_statusbar integer x = 325 integer y = 8 integer width = 302 integer height = 56 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long backcolor = 79741120 alignment alignment = center! boolean focusrectangle = false end type type st_message from statictext within w_statusbar integer x = 18 integer y = 8 integer width = 283 integer height = 56 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long backcolor = 79741120 alignment alignment = right! boolean focusrectangle = false end type
puis mettre dans la mdi
dans le close
// close status bar If IsValid(w_statusbar) Then Close(w_statusbar) End If
dans l'open
// open status bar Open(w_statusbar)
dans le resize
// notify status bar of resize If IsValid(w_statusbar) Then w_statusbar.wf_reposition() End If
Hors ligne