|
Post by ionmich on Apr 3, 2020 22:17:02 GMT 1
Has anyone written one, that I can modify for my needs?
Thanks in advance.
|
|
|
Post by bigbass on Apr 5, 2020 8:30:52 GMT 1
hello ionmich I modified a dynamic listbox demo now it takes a version 2.1 vcard backup from my android phone as is was tested as a (viewer) of course there are several vcard formats to choose from the idea is keep it simple and it displays the contacts you would need more to edit and save and there are other demos that would complete the project but this will get you started P.S. I would install an app on my phone because I am busy www.basic-converter.org/hug-tutorial/BaCon_widget_Examples_Documentation.htmlI just filtered the text to a simple human readable format any serious work would write back the vcard format so you could import it again on the phone Joe
'---readvcf.bac
'--- Include the files for making a GUI. INCLUDE "hug.bac"
'--- we want to "echo out" which listbox_selected$ was pressed
'----------------- SUB list_choices_demo '----------------- listbox_selected$ = GRAB$(list_choices) PRINT listbox_selected$ END SUB
'----------------- SUB MAKE_FILE_LIST '-----------------
'---here I used a version 2.1 vcard backup from my android phone as is result_input$ = EXEC$("cat contactbackup.vcf")
'---preparser filter
result_input$ = REPLACE$(result_input$, "VERSION:2.1", "") result_input$ = REPLACE$(result_input$, "BEGIN:VCARD", "") result_input$ = REPLACE$(result_input$, "END:VCARD", "===================") result_input$ = REPLACE$(result_input$, "FN:", "FULL NAME = ") result_input$ = REPLACE$(result_input$, "N:", "FIRST NAME = ") result_input$ = REPLACE$(result_input$, "X-GROUP:", "") result_input$ = REPLACE$(result_input$, "TEL;CELL:", "TELEPHONE = ") result_input$ = REPLACE$(result_input$, "TEL;CELL;PREF:", "PREFERED = ") result_input$ = REPLACE$(result_input$, "TEL;HOME:", "HOME PHONE = ") result_input$ = REPLACE$(result_input$, "EMAIL;HOME:", "EMAIL = ") result_input$ = REPLACE$(result_input$, ";", " ") PRINT result_input$
SPLIT result_input$ BY NL$ TO words$ SIZE dim
FOR i = 0 TO dim - 4 list_choices_text$ = words$[i] TEXT(list_choices, words$[i]) NEXT
END SUB
' 1.) Create your main working window, 350 pixels wide x 530 pixels high win = WINDOW( "BaCon listbox", 350, 530 )
Menu_label = MARK("Select an option from the Menu" , 220, 30) ATTACH( win, Menu_label, 5, 0 )
list_choices = LIST(340, 500 )
'force a callback MAKE_FILE_LIST
ATTACH(win, list_choices,5, 30) CALLBACK(list_choices, list_choices_demo)
DISPLAY
|
|
|
Post by bigbass on Apr 5, 2020 19:52:37 GMT 1
I am busy but had some free time today here is the second part the ENTRY of course if you don't mind to do some home work its a good place to at least start we would need a write output file too anyway we could use some more demos Joe INCLUDE hug.bac
win = WINDOW("Contact Maker",350,350)
'---make a frame or a box FRAME_STR = FRAME(320, 320) ATTACH( win, FRAME_STR, 10, 10 )
' we want to "echo out" text in the entry '--------------------' SUB entry_demo '--------------------' 'PRINT "entry_demo" PRINT GRAB$(My_entry1) PRINT GRAB$(My_entry2) PRINT GRAB$(My_entry3) PRINT GRAB$(My_entry4) END SUB
'=============My_entry1========================== My_entry1 = ENTRY("FIRST NAME",120,25) ATTACH(win,My_entry1,130,40)
' Create a label with text, 150 x 30 My_label = MARK( "FIRST NAME", 150, 30 )
' Attach the label to the main window ATTACH( win, My_label, -5, 40 )
'=============My_entry2========================== My_entry2 = ENTRY("LAST NAME",120,25) ATTACH(win,My_entry2,130,80)
' Create a label with text, 150 x 30 My_label2 = MARK( "LAST NAME", 150, 30 )
' Attach the label to the main window ATTACH( win, My_label2, -5, 80 )
'=============My_entry3========================== My_entry3 = ENTRY("HOME PHONE",120,25) ATTACH(win,My_entry3,130,120)
' Create a label with text, 150 x 30 My_label3 = MARK( "HOME PHONE", 150, 30 )
' Attach the label to the main window ATTACH( win, My_label3, -5, 120 )
'=============My_entry4==========================
My_entry4 = ENTRY("CELL PHONE",120,25) ATTACH(win,My_entry4,130,160)
' Create a label with text, 150 x 30 My_label3 = MARK( "CELL PHONE", 150, 30 )
' Attach the label to the main window ATTACH( win, My_label3, -5, 160 )
'have the buttton get all entries at one time My_button = BUTTON("SAVE",70,30) ATTACH(win,My_button,37,350-60) CALLBACK(My_button,entry_demo)
My_button2 = BUTTON("CLOSE",70,30) ATTACH(win,My_button2,231,350-60) CALLBACK(My_button2, QUIT)
DISPLAY
|
|
|
Post by ionmich on Apr 7, 2020 2:00:33 GMT 1
Thank you bigbass for the speedy response. I will study your code and see if I can adapt some of it for my use.
|
|
|
Post by bigbass on Apr 7, 2020 8:18:16 GMT 1
Hello I have a working program now that views *.vcf files and makes simple formatted vcf vcard contacts I just based everything on the output on my phone then reversed engineered the format in a simple way they are stand alone code contactmaker-viewer.tar.gz (20.14 KB) Joe before things start getting more complex allowing for many entries here it is this is a good demo to get started with HUG it will keep you busy and hope you have some fun
|
|