FLTK drawing lines

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Post Reply
eulenspiegel
Posts: 1
Joined: Nov 07, 2022 22:47

FLTK drawing lines

Post by eulenspiegel »

Hi there!

It's some time ago since I coded in BASIC. I was happy with tcl for the last years and still I am! But since the projects need to be ported to some costumer platforms executables would be nice to ease the roll out.
For the eye candy I want to draw lines between some points. For the moment I found a work around with boxes. But how to it the right way?

Thanks for reading!

Code: Select all

#Include "fltk-c.bi"

'Deklaration der Callback-Funktionen - die kommen unten:

Declare Sub Fonteinstellungen ()

Dim Shared As Integer result

Dim Shared As Integer Iabstand_kopfI 	= 50
Dim Shared As Integer Ilinker_randI 	= 50
Dim Shared As Integer ImenubarhoeheI 	= 30
Dim Shared As Integer IevpI 			= 1000
Dim Shared As Integer Iy_versatzI		= 50
Dim Shared As Integer Ibutton_upI		= 1300

Dim Shared As Fl_Window Ptr Window_Main

Dim Shared As Fl_Box Ptr Hilfsmittel
Dim Shared As Fl_Button Ptr Button


Sub CreateWindow_Main()
'Fenster mit Menü

	Window_Main = Fl_WindowNew(1500, 1000, "Menü-Test")
    
    
    var w = Fl_WidgetGetW(Window_Main)	'Fensterbreite
	var h = Fl_WidgetGetH(Window_Main)	'Fensterhöhe
	var box = BoxType(FL_BORDER_BOX)
  
	' Boxen malen, damit einzelne HiMi getrennt sind
	
	var grp = Fl_GroupNew(0,0,w,h)		'Gruppe erstellen (komplettes Fenster)
    
    Fl_GroupBegin grp
		Fl_BoxNew2(box, 0, ImenubarhoeheI, w, Iy_versatzI * 2, "")	'Boxtyp,x-onset,y-onset,x-offset,delta y-offset
		Fl_BoxNew2(box, 0, ImenubarhoeheI + Iy_versatzI * 2, w, Iy_versatzI * 2, "")
		''Fl_BoxNew2(box, 0, ImenubarhoeheI + Iy_versatzI * 3.5, w, Iy_versatzI, "")	
	Fl_GroupEnd grp


    ' Textboxen links: Art der Hilfsmittel
    Hilfsmittel = Fl_BoxNew (Ilinker_randI, Iabstand_kopfI + Iy_versatzI * 2, 800, 40, "Punkt 1")
    Fonteinstellungen
    Hilfsmittel = Fl_BoxNew (Ilinker_randI, Iabstand_kopfI + Iy_versatzI * 4, 800, 40, "Punkt 2")
    Fonteinstellungen
    Hilfsmittel = Fl_BoxNew (Ilinker_randI, Iabstand_kopfI + Iy_versatzI * 6, 800, 40, "Punkt 3")
    Fonteinstellungen
    Hilfsmittel = Fl_BoxNew (Ilinker_randI, Iabstand_kopfI + Iy_versatzI * 8, 800, 40, "Punkt 4")
    Fonteinstellungen
    Hilfsmittel = Fl_BoxNew (Ilinker_randI, Iabstand_kopfI + Iy_versatzI * 10, 800, 40, "Punkt 5")
    Fonteinstellungen  
    Hilfsmittel = Fl_BoxNew (Ilinker_randI, Iabstand_kopfI + Iy_versatzI * 12, 800, 40, "Punkt 6")
    Fonteinstellungen
    Hilfsmittel = Fl_BoxNew (Ilinker_randI, Iabstand_kopfI + Iy_versatzI * 14, 800, 40, "Punkt 7")
    Fonteinstellungen
    Hilfsmittel = Fl_BoxNew (Ilinker_randI, Iabstand_kopfI + Iy_versatzI * 16, 800, 40, "Punkt 8")
    Fonteinstellungen
    
    
    ' Textboxen Abrechungspreise
    Hilfsmittel = Fl_BoxNew (IevpI, Iabstand_kopfI + Iy_versatzI * 2, 100, 40, "21,54 €")
    Fonteinstellungen      

    
	Button = Fl_ButtonNew(Ibutton_upI, Iabstand_kopfI + Iy_versatzI * 2, 100, 40, "OK")

End Sub

	

'ohne Abfrage'

sub Fonteinstellungen ()
	Fl_WidgetSetAlign Hilfsmittel, Fl_ALIGN_TOP_LEFT or Fl_ALIGN_INSIDE
    Fl_WidgetSetLabelSize(Hilfsmittel, 40)
end sub

Sub Abfrage Cdecl (widget As FL_Widget Ptr)
    result = flChoice("Wollen Sie das Programm wirklich beenden?", "Ja", "Nein", "Vielleicht")

	Select Case result
	    Case 0
	        End
	    Case 1
	        '.....
	    Case 2
	        flMessageBox("Was soll das?", "Sie müssen sich schon entscheiden!")
	End Select
End Sub

CreateWindow_Main()

Fl_WidgetSetCallback0(Button, @Abfrage)
Fl_WindowShow(Window_Main)
Fl_Run

End
Post Reply