1. EuGTK: "font"

I was sidetracked with a Javascript project.
http://jtstory.fortunecity.com/dmak-javascript/dmak-js.html
(The data takes a while to load.)

But now I'm back on the EuGTK-based project.

  set(lstNutrientsREQ,"font",fonts[NUTRIENTS_REQ])  -- lst means list -- line 57 
  set(lstNutrientsNonREQ,"font",fonts[NUTRIENTS_NONREQ]) 
  set(lstFoods,"font",fonts[FOODS]) 
  set(lstRecipes,"font",fonts[FOODS]) 
  set(lstDiet,"font",fonts[DIET]) 
  set(txtFilter1,"font",fonts[TEXT]) -- txt means text 
  set(txtFilter2,"font",fonts[TEXT]) 
  set(txtFilter3,"font",fonts[TEXT]) 
  set(btnDec,"font",fonts[TEXT])  -- btn means button 
  set(btnSA1,"font",fonts[TEXT]) 
  set(btnCA1,"font",fonts[TEXT]) 
  set(btnCals,"font",fonts[TEXT]) 
  set(btnCA2,"font",fonts[TEXT]) 
  set(btnSA2,"font",fonts[TEXT]) 
  set(btnInc,"font",fonts[TEXT]) 
  set(lblSelectedFood,"font",fonts[LABELS])  -- lbl means label 
  set(lblSelectedNutrient,"font",fonts[LABELS]) 
  set(btnFave,"font",fonts[TEXT]) 
  set(btnCrap,"font",fonts[TEXT]) 

"font" seems to be not correct on some of them.

.../GtkEngine.e:337 in function set()                                                                            
A machine-level exception occurred during execution of this statement                                                                                                      
                                                                                                                                                                           
... /dmak_fonts.e:57 

new topic     » topic index » view message » categorize

2. Re: EuGTK: "font"

Need more info. Is lstNutrientsREQ a ListView, or a column, or ?

new topic     » goto parent     » topic index » view message » categorize

3. Re: EuGTK: "font"

irv said...

Need more info. Is lstNutrientsREQ a ListView, or a column, or ?

ListView.

 lstNutrientsREQ  = create(GtkTreeView), 
 lstNutrientsNonREQ  = create(GtkTreeView), 
 lstDiet  = create(GtkTreeView), 
 lstFoods  = create(GtkTreeView), 
 lstRecipes  = create(GtkTreeView) 
new topic     » goto parent     » topic index » view message » categorize

4. Re: EuGTK: "font"

Jerry: try running with -d SET to display the 'method' that is being called at that point, as well as the value of the pointer being passed. That might tell us something.

new topic     » goto parent     » topic index » view message » categorize

5. Re: EuGTK: "font"

irv said...

Jerry: try running with -d SET to display the 'method' that is being called at that point, as well as the value of the pointer being passed. That might tell us something.

That produces a huge amount of information. Here is a portion of it that might be relevant.

SET: font GtkTreeView 
{ 
  "override_font", 
  {33554436,150994948}, 
  0, 
  2517 
} 
{ 
  604291344, 
  "Georgia Bold 12" 
} 
SET: font GtkTreeView 
{ 
  "override_font", 
  {33554436,150994948}, 
  0, 
  2517 
} 
{ 
  604291904, 
  "Georgia Bold 12" 
} 
SET: font GtkTreeView 
{ 
  "override_font", 
  {33554436,150994948}, 
  0, 
  2517 
} 
{ 
  604293024, 
  "Georgia Bold 12" 
} 
SET: font GtkTreeView 
{ 
  "override_font", 
  {33554436,150994948}, 
  0, 
  2517 
} 

new topic     » goto parent     » topic index » view message » categorize

6. Re: EuGTK: "font"

Jerry_Story said...
irv said...

Jerry: try running with -d SET to display the 'method' that is being called at that point, as well as the value of the pointer being passed. That might tell us something.

That produces a huge amount of information. Here is a portion of it that might be relevant.

SET: font GtkTreeView 
{ 
  "override_font", 
  {33554436,150994948}, 
  0, 
  2517 
} 
{ 
  604291344,        <== pointer to object being affected 
  "Georgia Bold 12" 

OK, the next step is to see if somehow you're getting an invalid pointer to the TreeView - just after you create the TV, you can put a line to print the value of the pointer, then compare it with the <== marked value in the debug output.

As a work-around, you can always set the font on a per-column basis, see test33.ex for examples of this. e.g:

 constant col3 = create(GtkTreeViewColumn,"type=text, text=#1, font='Mono 10'") 
new topic     » goto parent     » topic index » view message » categorize

7. Re: EuGTK: "font"

irv said...
Jerry_Story said...

That produces a huge amount of information. Here is a portion of it that might be relevant.

SET: font GtkTreeView 
{ 
  "override_font", 
  {33554436,150994948}, 
  0, 
  2517 
} 
{ 
  604291344,        <== pointer to object being affected 
  "Georgia Bold 12" 

OK, the next step is to see if somehow you're getting an invalid pointer to the TreeView - just after you create the TV, you can put a line to print the value of the pointer, then compare it with the <== marked value in the debug output.

global constant 
 lstNutrientsREQ  = create(GtkTreeView), 
 lstNutrientsNonREQ  = create(GtkTreeView), 
 lstDiet  = create(GtkTreeView), 
 lstFoods  = create(GtkTreeView), 
 lstRecipes  = create(GtkTreeView) 
 
printf(1,"%d \n",{lstNutrientsREQ}) 
printf(1,"%d \n",{lstNutrientsNonREQ}) 
printf(1,"%d \n",{lstDiet}) 
printf(1,"%d \n",{lstFoods}) 
printf(1,"%d \n",{lstRecipes}) 

That produces different numbers each run.

1st run: 
578855000  
578855560  
578856120  
578856680  
578857240  
 
2nd run: 
591216728  
591217288  
591217848  
591218408  
591218968  

If I do
eui -d SET dmak.exw
there is so much information that I can't find the above numbers and I can't compare them with the -d SET numbers.

new topic     » goto parent     » topic index » view message » categorize

8. Re: EuGTK: "font"

It will produce different numbers each run, since they're pointers to the structure in memory. As for finding the # in the output, eui -d SET yourprog.ex > debug.txt then grep it!

A machine-level exception is pretty rare, even when developing the library, so I don't have a lot to go on or a good idea where to start debugging. I don't mind trying, if you want to zip up your program and send it to me. irvmull at gmail

new topic     » goto parent     » topic index » view message » categorize

9. Re: EuGTK: "font"

The numbers seem to be correct.

This line:
printf(1,"lstNutrientsREQ = %d \n",{lstNutrientsREQ})

produces:
lstNutrientsREQ = 576471128

This line:
set(lstNutrientsREQ,"font",fonts[NUTRIENTS_REQ])

produces:

SET: font GtkTreeView 
{ 
  "override_font", 
  {33554436,150994948}, 
  0, 
  2517 
} 
{ 
  576471128,   <-- same number 
  "Georgia Bold 12" 
} 

new topic     » goto parent     » topic index » view message » categorize

10. Re: EuGTK: "font"

Jerry_Story said...

The numbers seem to be correct.

This line:
printf(1,"lstNutrientsREQ = %d \n",{lstNutrientsREQ})

produces:
lstNutrientsREQ = 576471128

This line:
set(lstNutrientsREQ,"font",fonts[NUTRIENTS_REQ])

produces:

SET: font GtkTreeView 
{ 
  "override_font", 
  {33554436,150994948}, 
  0, 
  2517 
} 
{ 
  576471128,   <-- same number 
  "Georgia Bold 12" 
} 

Edited to remove suggestion, we already know it is the correct class. I need the source to get to the bottom of this error.

new topic     » goto parent     » topic index » view message » categorize

11. Re: EuGTK: "font"

Apparently the error has nothing to do with fonts, but was caused by memory corruption elsewhere. Fortunately, this is pretty rare, since it's close to impossible to track down.

new topic     » goto parent     » topic index » view message » categorize

12. Re: EuGTK: "font"

irv said...

Apparently the error has nothing to do with fonts, but was caused by memory corruption elsewhere. Fortunately, this is pretty rare, since it's close to impossible to track down.

This is where valgrind really shines. The easiest way to diagnose is probably to translate your program with debugging turned on, and then run it under valgrind:

$ valgrind ./myapp 

Matt

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu