[Basic] fenêtre avec barre de défilement fonctionnel

Discussions et questions sur tout ce qui concerne la programmation tous langages et tous modules confondus.

Modérateur : Vilains modOOs

Règles du forum
:alerte: Balisage obligatoire dans cette section !
Aidez-nous à vous aider au mieux en balisant correctement votre question : reportez-vous sur les règles de cette section avant de poster !
Répondre
Avatar de l’utilisateur
hamilton
Membre OOrganisé
Membre OOrganisé
Messages : 70
Inscription : 17 août 2016 19:41

[Basic] fenêtre avec barre de défilement fonctionnel

Message par hamilton »

Bonsoir,
J'ai une Fenêtre avec une barre de défilement (ScrollBar) qui n'est pas fonctionel. Les graphiques ne se déplacent pas sur l'arrière-plan. Comme faire la fonctionner. Il y a quelqu'un qui me aide.

Code : Tout sélectionner

 REM  *****  BASIC  *****
Dim oWindow as Object, paintlistener as Object, graphic as Object

Sub Main
   oAwtToolkit = CreateUnoService( "com.sun.star.awt.Toolkit" )
     ' Create a top level window.
   oWindow = CreateNewWindow( oAwtToolkit, 100, 200, 400, 500 )
      
   oDoc = ThisComponent
   oParentFrame = oDoc.CurrentController.Frame
   'oPeer = oParentFrame.ContainerWindow
   'oToolkit = oPeer.Toolkit
   'oWindow = CreateNewWindow(oToolkit,oPeer,100,100,200,250)
   oFrame = CreateUnoService("com.sun.star.frame.Frame")
   oFrame.initialize(oWindow)
   oFrame.setCreator(oParentFrame)
   oFrame.setName("NewFrame")
   oFrame.Title = "New Frame"
   oParentFrame.getFrames().append(oFrame)   
   'oWindow.setVisible(True) 
 
   oWindow.Title = "Mon Graphique"  
   oWindow.setBackground(RGB(255,255,255) )'' RGB( 210, 210, 255 )
''  
  oBtnCtrl = MakeButtonCtrl( oAwtToolkit, oWindow, "OK", 62, 200, 76,30 )
   oMouseListener = CreateUnoListener("Mouse_", "com.sun.star.awt.XMouseListener")
   oBtnCtrl.addMouseListener(oMouseListener)   
    '
   oScrollCtrl = MakeScrollCtrl( oAwtToolkit, oWindow, "ScrollBar1", 0, 20,20,400)
   '
    paintlistener = createUnoListener("XPaintListener_", "com.sun.star.awt.XPaintListener")
    oWindow.addPaintListener(paintlistener)   
	
End Sub

''--------------------------------------------------------------------

Function CreateNewWindow(oAwtToolkit,nX,nY,nWidth,nHeight) As Object

   aRect = CreateUnoStruct("com.sun.star.awt.Rectangle")
   With aRect
      .X = nX
      .Y = nY
      .Width = nWidth
      .Height = nHeight
   End With
   aWinDesc = CreateUnoStruct("com.sun.star.awt.WindowDescriptor")
   With aWinDesc
      '.Type = com.sun.star.awt.WindowClass.CONTAINER
      .Type = com.sun.star.awt.WindowClass.TOP
      .WindowServiceName = "dialog"
      .ParentIndex = -1
      .Bounds = aRect
      ''.Parent = oAwtToolkit.getDesktopWindow()
      '--.Parent = parentWindow   'oParent'''null' ' 
      .WindowAttributes =0
      .WindowAttributes =.WindowAttributes+ com.sun.star.awt.WindowAttribute.SHOW
      .WindowAttributes =.WindowAttributes+ com.sun.star.awt.WindowAttribute.MOVEABLE 
      .WindowAttributes =.WindowAttributes+ com.sun.star.awt.WindowAttribute.SIZEABLE
      .WindowAttributes =.WindowAttributes+ com.sun.star.awt.WindowAttribute.BORDER
      .WindowAttributes =.WindowAttributes+ com.sun.star.awt.WindowAttribute.CLOSEABLE
      
      ''+ com.sun.star.awt.WindowAttribute.MINSIZE
   End With
   CreateNewWindow = oAwtToolkit.createWindow(aWinDesc)
   
End Function

Function MakeButtonCtrl(oAwtToolkit, oWindow,cLabel,nX,nY,nWidth,nHeight )
   oButtonModel = CreateUnoService("com.sun.star.awt.UnoControlButtonModel")
   oButtonCtrl = CreateUnoService("com.sun.star.awt.UnoControlButton")
   oButtonCtrl.setModel(oButtonModel)
   oButtonCtrl.createPeer(oAwtToolkit, oWindow)
   oButtonModel.Label = cLabel
   oButtonModel.DefaultButton = True  
   oButtonCtrl.setPosSize(nX,nY,nWidth,nHeight,com.sun.star.awt.PosSize.POSSIZE)
   MakeButtonCtrl = oButtonCtrl
End Function
''--------------------------------------------------------
Function MakeScrollCtrl( oAwtToolkit, oWindow, Optional cLabel,nX1,nY1,nWidth1,nHeight1)'
   ' Create a new button model.
   oScrollModel = CreateUnoService( "com.sun.star.awt.UnoControlScrollBarModel")
     
   oScrollModel.BlockIncrement = 20
   oScrollModel.ScrollValueMin=5
  'ScrollBarOrientation =1 
   oScrollModel.Orientation = 1'Horizontal=0 ' Vertical=1
   oScrollModel.Border=2
   oScrollModel.ScrollValueMax = 100'
   oScrollModel.LineIncrement = 5'
   oScrollModel.VisibleSize = 20'nVisble
   oScrollModel.LiveScroll = True
    ' Create a new button control. 
   oScrollCtrl = CreateUnoService( "com.sun.star.awt.UnoControlScrollBar")
   oScrollCtrl.setPosSize(nX1,nY1,nWidth1,nHeight1,com.sun.star.awt.PosSize.POSSIZE) 
    
   ' Tell the control that it has a model.
   oScrollCtrl.setModel( oScrollModel )
     
   oScrollCtrl.createPeer( oAwtToolkit, oWindow )
    
   MakeScrollCtrl = oScrollCtrl
End Function
'--------------------------------------------------------
Sub XPaintListener_WindowPaint(oEv)
   If oEv.count > 0 Then Exit Sub   
   win = oEv.Source
   Graphic = win.createGraphics
    graphic.FillColor = rgb(30,144,255)
    graphic.LineColor = -1
    graphic.drawEllipse(20+50,20,160,160)
    graphic.FillColor = rgb(23,23,135)
    graphic.drawRoundedRect(5+50,82,190,36,10,10)
    font = win.AccessibleContext.Font
    fontdesc = font.FontDescriptor
    fontdesc.Name = "Arial"
    fontdesc.Family = 5
    fontdesc.Weight = 200
    fontdesc.Height = 22
    graphic.selectFont(fontdesc)
    graphic.TextColor = rgb(255,255,255)
    graphic.drawText(11+50,87,"  OPEN OFFICE")
    ''
    graphic.drawEllipse(40+50,240,160,160)
    
End sub

Sub Mouse_mousePressed(oEv as Object)
   oEv.Source.AccessibleContext.AccessibleParent.dispose
End Sub
Sub Mouse_disposing(oEv as Object)
End Sub
Sub Mouse_mouseEntered(oEv as Object)
End Sub
Sub Mouse_mouseExited(oEv as Object)
End Sub
Sub Mouse_mouseReleased(oEv as Object)
End Sub

sub XPaintListener_disposing(oEv)
end sub  
OpenOffice 4.1.10 sur Windows 7(64) , Eclipse "Mars"
LibreOffice 6.2 sur Windows 8(64)
Avatar de l’utilisateur
luky-luke
InconditiOOnnel
InconditiOOnnel
Messages : 936
Inscription : 27 nov. 2010 01:17
Localisation : gâtine deux-sèvrienne

Re: [Basic] fenêtre avec barre de défilement fonctionnel

Message par luky-luke »

Bonjour
Un début de réponse dans ce fil : Barres de défilement dans boîte de dialogue

Cordialement
Luke
AOO 4.1.3 et LibO 5.3.7.2 Ubuntu 16.04 LTS et Debian 9
Xray ne tient pas lieu de tout, mais une pratique sans Xray ne vaut pas grand chose
Avatar de l’utilisateur
ThierryT
Membre enthOOusiaste
Membre enthOOusiaste
Messages : 467
Inscription : 10 nov. 2012 18:05

Re: [Basic] fenêtre avec barre de défilement fonctionnel

Message par ThierryT »

Voir ce lien sur le site anglophone : https://forum.openoffice.org/en/forum/v ... 20&t=69191
LibreOffice 6.1.3.2 x64 / AOO 4.1.5 (x86) sous Windows 8.1 (x64)
Java 8.x (x64 et x86), Firefox, Thunderbird,....

“Celui qui aime à apprendre est bien près du savoir.” (Confusius)
Comment baliser Résolu
Avatar de l’utilisateur
hamilton
Membre OOrganisé
Membre OOrganisé
Messages : 70
Inscription : 17 août 2016 19:41

Re: [Basic] fenêtre avec barre de défilement fonctionnel

Message par hamilton »

Bonsoir,

luky-luke les Barres de défilement dans boîte de dialogue ont des erreurs
ThierryT la programmation c'est dans python
Je ajouté deux parts de code avec Functions nouvelles, basé sur information fournie. Mais continue de fonctionner comme précédente. Je pense qu'íl est chemin correct. Où est le erreur ?.
Voici le code.

Code : Tout sélectionner

 REM  *****  BASIC  *****

Dim oWindow as Object, paintlistener as Object, graphic as Object

Sub Main
   oAwtToolkit = CreateUnoService( "com.sun.star.awt.Toolkit" )
     ' Create a top level window.
   oWindow = CreateNewWindow( oAwtToolkit, 100, 200, 400, 500 )
      
   oDoc = ThisComponent
   oParentFrame = oDoc.CurrentController.Frame
   'oPeer = oParentFrame.ContainerWindow
   'oToolkit = oPeer.Toolkit
   'oWindow = CreateNewWindow(oToolkit,oPeer,100,100,200,250)
   oFrame = CreateUnoService("com.sun.star.frame.Frame")
   oFrame.initialize(oWindow)
   oFrame.setCreator(oParentFrame)
   oFrame.setName("NewFrame")
   oFrame.Title = "New Frame"
   oParentFrame.getFrames().append(oFrame)   
   'oWindow.setVisible(True) 
 
   oWindow.Title = "Mon Graphique"  
   oWindow.setBackground(RGB(255,255,255) )'' RGB( 210, 210, 255 )
''  
  oBtnCtrl = MakeButtonCtrl( oAwtToolkit, oWindow, "OK", 62, 200, 76,30 )
   oMouseListener = CreateUnoListener("Mouse_", "com.sun.star.awt.XMouseListener")
   oBtnCtrl.addMouseListener(oMouseListener)   
    '  
   oScrollCtrl = MakeScrollCtrl( oAwtToolkit, oWindow, "ScrollBar1", 0, 20,20,400)
   '
   oContainer = createControlContainer( oAwtToolKit,oWindow,200,200,400,500, "color" )'''
   
    paintlistener = createUnoListener("XPaintListener_", "com.sun.star.awt.XPaintListener")
    oWindow.addPaintListener(paintlistener) 
    '
   
     oScrollListener = CreateUnoListener("ScrollAdjust2_", "com.sun.star.awt.XAdjustmentListener")
  
     oContainer.addControl("vscroll",oScrollCtrl) '
     oScrollCtrl.addAdjustmentListener(oScrollListener)
     oScrollCtrl.removeAdjustmentListener(oScrollListener)
End Sub

''--------------------------------------------------------------------

Function CreateNewWindow(oAwtToolkit,nX,nY,nWidth,nHeight) As Object

   aRect = CreateUnoStruct("com.sun.star.awt.Rectangle")
   With aRect
      .X = nX
      .Y = nY
      .Width = nWidth
      .Height = nHeight
   End With
   aWinDesc = CreateUnoStruct("com.sun.star.awt.WindowDescriptor")
   With aWinDesc
      '.Type = com.sun.star.awt.WindowClass.CONTAINER
      .Type = com.sun.star.awt.WindowClass.TOP
      .WindowServiceName = "dialog"
      .ParentIndex = -1
      .Bounds = aRect
      ''.Parent = oAwtToolkit.getDesktopWindow()
      '--.Parent = parentWindow   'oParent'''null' ' 
      .WindowAttributes =0
      .WindowAttributes =.WindowAttributes+ com.sun.star.awt.WindowAttribute.SHOW
      .WindowAttributes =.WindowAttributes+ com.sun.star.awt.WindowAttribute.MOVEABLE 
      .WindowAttributes =.WindowAttributes+ com.sun.star.awt.WindowAttribute.SIZEABLE
      .WindowAttributes =.WindowAttributes+ com.sun.star.awt.WindowAttribute.BORDER
      .WindowAttributes =.WindowAttributes+ com.sun.star.awt.WindowAttribute.CLOSEABLE
      
      ''+ com.sun.star.awt.WindowAttribute.MINSIZE
   End With
   CreateNewWindow = oAwtToolkit.createWindow(aWinDesc)
   
End Function

Function MakeButtonCtrl(oAwtToolkit, oWindow,cLabel,nX,nY,nWidth,nHeight )
   oButtonModel = CreateUnoService("com.sun.star.awt.UnoControlButtonModel")
   oButtonCtrl = CreateUnoService("com.sun.star.awt.UnoControlButton")
   oButtonCtrl.setModel(oButtonModel)
   oButtonCtrl.createPeer(oAwtToolkit, oWindow)
   oButtonModel.Label = cLabel
   oButtonModel.DefaultButton = True  
   oButtonCtrl.setPosSize(nX,nY,nWidth,nHeight,com.sun.star.awt.PosSize.POSSIZE)
   MakeButtonCtrl = oButtonCtrl
End Function
''--------------------------------------------------------
Function MakeScrollCtrl( oAwtToolkit, oWindow, Optional cLabel,nX1,nY1,nWidth1,nHeight1)'
   ' Create a new button model.
   oScrollModel = CreateUnoService( "com.sun.star.awt.UnoControlScrollBarModel")
     
   oScrollModel.BlockIncrement = 20
   oScrollModel.ScrollValueMin=5
  'ScrollBarOrientation =1 
   oScrollModel.Orientation = 1'Horizontal=0 ' Vertical=1
   oScrollModel.Border=2
   oScrollModel.ScrollValueMax = 100'
   oScrollModel.LineIncrement = 5'
   oScrollModel.VisibleSize = 20'nVisble
   oScrollModel.LiveScroll = True
    ' Create a new button control. 
   oScrollCtrl = CreateUnoService( "com.sun.star.awt.UnoControlScrollBar")
   oScrollCtrl.setPosSize(nX1,nY1,nWidth1,nHeight1,com.sun.star.awt.PosSize.POSSIZE) 
    
   ' Tell the control that it has a model.
   oScrollCtrl.setModel( oScrollModel )
     
   oScrollCtrl.createPeer( oAwtToolkit, oWindow )
    
   MakeScrollCtrl = oScrollCtrl
End Function
'--------------------------------------------------------
Sub XPaintListener_WindowPaint(oEv)
   If oEv.count > 0 Then Exit Sub   
   win = oEv.Source
   Graphic = win.createGraphics
    graphic.FillColor = rgb(30,144,255)
    graphic.LineColor = -1
    graphic.drawEllipse(20+50,20,160,160)
    graphic.FillColor = rgb(23,23,135)
    graphic.drawRoundedRect(5+50,82,190,36,10,10)
    font = win.AccessibleContext.Font
    fontdesc = font.FontDescriptor
    fontdesc.Name = "Arial"
    fontdesc.Family = 5
    fontdesc.Weight = 200
    fontdesc.Height = 22
    graphic.selectFont(fontdesc)
    graphic.TextColor = rgb(255,255,255)
    graphic.drawText(11+50,87,"  OPEN OFFICE")
    ''
    graphic.drawEllipse(40+50,240,160,160)
    
End sub

Sub Mouse_mousePressed(oEv as Object)
   oEv.Source.AccessibleContext.AccessibleParent.dispose
End Sub
Sub Mouse_disposing(oEv as Object)
End Sub
Sub Mouse_mouseEntered(oEv as Object)
End Sub
Sub Mouse_mouseExited(oEv as Object)
End Sub
Sub Mouse_mouseReleased(oEv as Object)
End Sub

sub XPaintListener_disposing(oEv)
end sub

'''--------------------------------------------------------------------

'''''-------------------------------------------------------------------------------
Function createControlContainer( oAwtToolKit,oWindow,oSizeX, oSizeY, oSizeWidth, oSizeHeight, optional color as string ) 
	dim oContainerModel
	dim oContainer

'Build a container with some controls
	oContainerModel = createUnoService( "com.sun.star.awt.UnoControlContainerModel" )
		oContainerModel.BackgroundColor =-1
	if color = "color1" then
	    oContainerModel.BackgroundColor =RGB( 231, 231, 231 )''grey='yellow=RGB(255,255,0)
	end if
	oContainer = createUnoService( "com.sun.star.awt.UnoControlContainer" )
	oContainer.setModel( oContainerModel )
	oContainer.setContext( oWindow )
	oContainer.createPeer( oAwtToolKit, oWindow )
	oContainer.setPosSize( oSizeX, oSizeY, oSizeWidth, oSizeHeight, com.sun.star.awt.PosSize.POSSIZE )
	createControlContainer = oContainer
end Function

Function getContainerFromEvent( oEvent as object ) as object 
	getContainerFromEvent = oEvent.Source.getContext( )
end Function
'''''--------------------------------------------------------------------------------
Sub ScrollAdjust2_adjustmentValueChanged( ev As com.sun.star.awt.AdjustmentEvent )
  nValue = ev.Value
  oContainer.setPosSize(200,200-nValue,400,500,com.sun.star.awt.PosSize.Y)'.PosSize.POSSIZE)'
End Sub
Sub ScrollAdjust2_disposing(ev)
End Sub
 
OpenOffice 4.1.10 sur Windows 7(64) , Eclipse "Mars"
LibreOffice 6.2 sur Windows 8(64)
Avatar de l’utilisateur
Hubert Lambert
SuppOOrter
SuppOOrter
Messages : 1214
Inscription : 06 avr. 2016 09:26

Re: [Basic] fenêtre avec barre de défilement fonctionnel

Message par Hubert Lambert »

Bonjour,

Ci-dessous un exemple fonctionnel. Les graphiques appartiennent à une fenêtre indépendante de la fenêtre principale et de la barre de défilement :

Code : Tout sélectionner

global graphwin as object

Sub Main
   tk = CreateUnoService("com.sun.star.awt.Toolkit")
   topwin = createtopwindow(tk, 100, 200, 400, 500)
   topwin.Title = "Test"
   'décommenter la ligne suivante pour visualiser la fenêtre
'   topwin.setBackground(RGB(255,255,255))

   createbutton(tk, topwin, "FERMER", 10, 10, 70, 30)
   creategraphwindow(tk, 90, 10, 300, 1000, topwin)
   scrollbar = createscrollbar(tk, topwin, "ScrollBar", 10, 50, 20, 440,_
   					graphwin.Size.Height-topwin.Size.Height+30)
   topwin.execute()
   topwin.dispose()
End Sub

Function createbutton(tk, win, label, X, Y, Width, Height)
   model = CreateUnoService("com.sun.star.awt.UnoControlButtonModel")
   model.Label = label
   model.DefaultButton = True
   control = CreateUnoService("com.sun.star.awt.UnoControlButton")
   control.setModel(model)
   control.setActionCommand("fermer")
   control.setPosSize(X, Y, Width, Height, com.sun.star.awt.PosSize.POSSIZE)
   actlistener = createUnoListener("actlistener_", "com.sun.star.awt.XActionListener")
   control.addActionListener(actlistener)
   control.createPeer(tk, win)
   createbutton = control
End Function

Sub actlistener_actionPerformed(ev)
	if ev.ActionCommand = "fermer" then
		ev.Source.AccessibleContext.AccessibleParent.endExecute()
	end if
End Sub

Sub actlistener_disposing(ev)
End Sub

Function createscrollbar(tk, win, label, X, Y, Width, Height, max)
   model = CreateUnoService( "com.sun.star.awt.UnoControlScrollBarModel")
   model.BlockIncrement = 20
   model.ScrollValueMin = 0
   model.Orientation = 1 'Horizontal=0 ' Vertical=1
   model.Border = 0
   model.ScrollValueMax = max
   model.LineIncrement = 5
   model.VisibleSize = 10
   model.LiveScroll = True
   control = CreateUnoService( "com.sun.star.awt.UnoControlScrollBar")
   control.setPosSize(x, Y, Width, Height, com.sun.star.awt.PosSize.POSSIZE)
   control.setModel(model)
   adjustlistener = createUnoListener("adjustlistener_", "com.sun.star.awt.XAdjustmentListener")
   control.addAdjustmentListener(adjustlistener)
   control.createPeer(tk, win)
   createscrollbar = control
End Function

Sub adjustlistener_adjustmentValueChanged(ev)
	graphwin.setPosSize(0,10-ev.Value,0,0,2)
'	xray graphwin
End Sub

Sub adjustlistener_disposing(ev)
End Sub

Function createtopwindow(tk, X, Y, Width, Height) As Object
   rect = CreateUnoStruct("com.sun.star.awt.Rectangle")
   With rect
      .X = X
      .Y = Y
      .Width = Width
      .Height = Height
   End With
   desc = CreateUnoStruct("com.sun.star.awt.WindowDescriptor")
   with com.sun.star.awt.WindowAttribute
      attributes = .MOVEABLE + .SIZEABLE + .BORDER + .CLOSEABLE
   end with
   With desc
      .Type = com.sun.star.awt.WindowClass.TOP
      .WindowServiceName = "dialog"
      .ParentIndex = -1
      .Bounds = rect
      .WindowAttributes = attributes
   End With
   createtopwindow = tk.createWindow(desc)
End Function

Sub creategraphwindow(tk, X, Y, Width, Height, parent) As Object
   rect = CreateUnoStruct("com.sun.star.awt.Rectangle")
   With rect
      .X = X
      .Y = Y
      .Width = Width
      .Height = Height
   End With
   desc = CreateUnoStruct("com.sun.star.awt.WindowDescriptor")
   With desc
      .Type = com.sun.star.awt.WindowClass.SIMPLE
      .WindowServiceName = "window"
      .Parent = parent
      .Bounds = rect
      .WindowAttributes = com.sun.star.awt.WindowAttribute.SHOW
   End With
   graphwin = tk.createWindow(desc)
   graphwin.setBackground(RGB(240,240,240))
   paintlistener = createUnoListener("XPaintListener_", "com.sun.star.awt.XPaintListener")
   graphwin.addPaintListener(paintlistener)
End Sub

Sub XPaintListener_WindowPaint(oEv)
   If oEv.count > 0 Then Exit Sub   
   win = oEv.Source
   Graphic = win.createGraphics
   graphic.FillColor = rgb(30,144,255)
   graphic.LineColor = -1
   graphic.drawEllipse(20+50,20,160,160)
   graphic.FillColor = rgb(23,23,135)
   graphic.drawRoundedRect(5+50,82,190,36,10,10)
   font = win.AccessibleContext.Font
   fontdesc = font.FontDescriptor
   fontdesc.Name = "Arial"
   fontdesc.Family = 5
   fontdesc.Weight = 200
   fontdesc.Height = 22
   graphic.selectFont(fontdesc)
   graphic.TextColor = rgb(255,255,255)
   graphic.drawText(11+50,87,"  OPEN OFFICE")
   graphic.drawEllipse(40+50,240,160,160)
End sub

Sub XPaintListener_disposing(oEv)
End Sub
Cordialement.
Pièces jointes
hamilton.odt
(12.33 Kio) Téléchargé 105 fois
AOOo 4.1.7 sur Win10
AOOo 4.1.x sur Linux Mint
LibreOffice 5.x/6.x sur Linux Mint
--
| « Nos défauts devraient nous donner une qualité : l'indulgence pour les défauts des autres » (Rivarol)
Avatar de l’utilisateur
hamilton
Membre OOrganisé
Membre OOrganisé
Messages : 70
Inscription : 17 août 2016 19:41

Re: [Basic] fenêtre avec barre de défilement fonctionnel

Message par hamilton »

Bonsoir,
Grand merci Hubert Lambert . Le code n'est pas difficile, très compliqué, il fonctionne Bien. C'est merveilleux.
OpenOffice 4.1.10 sur Windows 7(64) , Eclipse "Mars"
LibreOffice 6.2 sur Windows 8(64)
Avatar de l’utilisateur
hamilton
Membre OOrganisé
Membre OOrganisé
Messages : 70
Inscription : 17 août 2016 19:41

Re: [Basic] fenêtre avec barre de défilement fonctionnel

Message par hamilton »

Bonsoir.
J'ai une autre question. Comme positioner la barre de défilement automatiquement à le côté droite de la Fenêtre, ou a le fond ?. Existera une fonction pour ce.

Par exemple :
x= côté droite, -> au lieu de x=10
Y= fond
control.setPosSize(x, Y, Width, Height, com.sun.star.awt.PosSize.POSSIZE)

scrollbar = createscrollbar(tk, topwin, "ScrollBar", 10, 50, 20, 440,graphwin.Size.Height-topwin.Size.Height+30)
OpenOffice 4.1.10 sur Windows 7(64) , Eclipse "Mars"
LibreOffice 6.2 sur Windows 8(64)
Avatar de l’utilisateur
Hubert Lambert
SuppOOrter
SuppOOrter
Messages : 1214
Inscription : 06 avr. 2016 09:26

Re: [Basic] fenêtre avec barre de défilement fonctionnel

Message par Hubert Lambert »

Positionner la barre de défilement à droite ou en bas n'est pas très sorcier :
- à droite (X) = largeur_fenêtre - (largeur_barre + marge) ;
- en bas (Y) = hauteur_fenêtre - (hauteur_barre + marge).
AOOo 4.1.7 sur Win10
AOOo 4.1.x sur Linux Mint
LibreOffice 5.x/6.x sur Linux Mint
--
| « Nos défauts devraient nous donner une qualité : l'indulgence pour les défauts des autres » (Rivarol)
Avatar de l’utilisateur
ThierryT
Membre enthOOusiaste
Membre enthOOusiaste
Messages : 467
Inscription : 10 nov. 2012 18:05

Re: [Basic] fenêtre avec barre de défilement fonctionnel

Message par ThierryT »

Le lien que j'ai fourni en exemple sur le site anglophone parle de python mais l'exemple donné par Villeroy est en Basic lui....
J'ai d'ailleurs utilisé cet exemple (que j'ai adapté bien sûr) dans une application que j'ai développé il y a un peu plus de deux ans maintenant et cela fonctionne parfaitement.
Il faut lire les fils fournis dans leur intégralité....
LibreOffice 6.1.3.2 x64 / AOO 4.1.5 (x86) sous Windows 8.1 (x64)
Java 8.x (x64 et x86), Firefox, Thunderbird,....

“Celui qui aime à apprendre est bien près du savoir.” (Confusius)
Comment baliser Résolu
Avatar de l’utilisateur
hamilton
Membre OOrganisé
Membre OOrganisé
Messages : 70
Inscription : 17 août 2016 19:41

Re: [Basic] fenêtre avec barre de défilement fonctionnel

Message par hamilton »

Bonsoir,
J'ai utilisé pour le côté droit (x=oWindow.Size.Width-30), à la bas (y=oWindow.Size.Height-30), mais ils sont statiques, si ont ouvre le Fenêtre, les Barres de défilement resteront au miliau de la Fenêtre.
ThierryT votre code était très compliquée.
OpenOffice 4.1.10 sur Windows 7(64) , Eclipse "Mars"
LibreOffice 6.2 sur Windows 8(64)
Répondre